aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2017-12-14 23:54:06 +0000
committerWilfred Hughes <me@wilfred.me.uk>2017-12-14 23:55:35 +0000
commitdce09e9c338c8733254e10387ad0dc118a89bd82 (patch)
tree079e7eb9fc2e58f5711c58374c84c1b629575278
parentc53fc352fcbf633285bbb85faed1a5b8ceab2fde (diff)
Ensure that we don't call find-file with propertized strings0.4
This breaks recentf, as it serialises the propertized string to a file ~/.recentf and then Emacs can't read the file on startup. Fixes #68.
-rw-r--r--CHANGELOG.md3
-rw-r--r--helpful.el8
2 files changed, 10 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 721948c..bf0033b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,9 @@ interactively defined functions being edebugged.
Added a cleanup command `helpful-kill-buffers`.
+Fixed an issue with helpful making recentf write broken paths to
+~/.recentf, breaking Emacs startup.
+
# v0.3
Fixed a crash on autoloaded functions that aren't loaded yet.
diff --git a/helpful.el b/helpful.el
index 7b536c8..03740cb 100644
--- a/helpful.el
+++ b/helpful.el
@@ -225,9 +225,15 @@ or disable if already enabled."
'follow-link t
'help-echo "Navigate to definition")
+(defun helpful--no-properties (s)
+ "Return a copy of S without any properties."
+ (with-temp-buffer
+ (insert s)
+ (buffer-substring-no-properties (point-min) (point-max))))
+
(defun helpful--navigate (button)
"Navigate to the path this BUTTON represents."
- (find-file (button-get button 'path))
+ (find-file (helpful--no-properties (button-get button 'path)))
;; We use `get-text-property' to work around an Emacs 25 bug:
;; http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=f7c4bad17d83297ee9a1b57552b1944020f23aea
(-when-let (pos (get-text-property button 'position