From 6e51dd249ab78bccb566013767037dcabc54af9c Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 24 Mar 2018 04:47:52 -0400 Subject: [PATCH] feature/popup: fix wrong-num-of-args error following helpful links --- modules/feature/popup/+hacks.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/feature/popup/+hacks.el b/modules/feature/popup/+hacks.el index b77abbd19..47ded5e64 100644 --- a/modules/feature/popup/+hacks.el +++ b/modules/feature/popup/+hacks.el @@ -142,14 +142,20 @@ the command buffer." ;; `helpful' (after! helpful - (defun +popup*helpful--navigate (orig-fn &rest args) - (let (origin) + (defun +popup*helpful--navigate (button) + (let ((path (substring-no-properties (button-get button 'path))) + origin) (save-popups! - (apply orig-fn args) + (find-file 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 + (marker-buffer button))) + (goto-char pos)) (setq origin (selected-window)) (recenter)) (select-window origin))) - (advice-add #'helpful--navigate :around #'+popup*helpful--navigate)) + (advice-add #'helpful--navigate :override #'+popup*helpful--navigate)) ;; `neotree'