From dce09e9c338c8733254e10387ad0dc118a89bd82 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Thu, 14 Dec 2017 23:54:06 +0000 Subject: 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. --- CHANGELOG.md | 3 +++ helpful.el | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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 -- cgit v1.0