commit dce09e9c338c8733254e10387ad0dc118a89bd82
parent c53fc352fcbf633285bbb85faed1a5b8ceab2fde
Author: Wilfred Hughes <me@wilfred.me.uk>
Date: Thu, 14 Dec 2017 23:54:06 +0000
Ensure that we don't call find-file with propertized strings
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.
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git 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
@@ -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