feature/popup: fix wrong-num-of-args error following helpful links

This commit is contained in:
Henrik Lissner 2018-03-24 04:47:52 -04:00
parent 988e70683e
commit 6e51dd249a
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -142,14 +142,20 @@ the command buffer."
;; `helpful' ;; `helpful'
(after! helpful (after! helpful
(defun +popup*helpful--navigate (orig-fn &rest args) (defun +popup*helpful--navigate (button)
(let (origin) (let ((path (substring-no-properties (button-get button 'path)))
origin)
(save-popups! (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)) (setq origin (selected-window))
(recenter)) (recenter))
(select-window origin))) (select-window origin)))
(advice-add #'helpful--navigate :around #'+popup*helpful--navigate)) (advice-add #'helpful--navigate :override #'+popup*helpful--navigate))
;; `neotree' ;; `neotree'