From 97acd146968d69bb624070b79266fa3bf3758a4b Mon Sep 17 00:00:00 2001 From: Al Haji-Ali Date: Sat, 28 Sep 2024 22:34:20 +0100 Subject: [PATCH] Fix advice for elisp--company-doc-buffer --- emacs/radian.el | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/emacs/radian.el b/emacs/radian.el index 9abd4cb..b9593df 100644 --- a/emacs/radian.el +++ b/emacs/radian.el @@ -3960,13 +3960,21 @@ bizarre reason." (with-eval-after-load 'helpful (radian-defadvice radian--advice-company-elisp-use-helpful - (func &rest args) + (func str &rest args) :around #'elisp--company-doc-buffer "Cause `company' to use Helpful to show Elisp documentation." - (cl-letf (((symbol-function #'describe-function) #'helpful-function) - ((symbol-function #'describe-variable) #'helpful-variable) - ((symbol-function #'help-buffer) #'current-buffer)) - (apply func args)))) + (cl-letf* ((helpful-buffer nil) + ((symbol-function #'describe-function) + (lambda (&rest args) + (apply 'helpful-function args) + (setq helpful-buffer (current-buffer)))) + ((symbol-function #'describe-variable) + (lambda (&rest args) + (apply 'helpful-variable args) + (setq helpful-buffer (current-buffer)))) + (symbol (intern-soft str)) + (buf (apply func symbol args))) + (or helpful-buffer buf)))) (radian-defadvice radian--advice-fill-elisp-docstrings-correctly (&rest _) :before-until #'fill-context-prefix