From 85f22aaadd7481aa2b938f2e551c07f8f16a2a1f 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 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/emacs/radian.el b/emacs/radian.el index 9abd4cb..6e5a700 100644 --- a/emacs/radian.el +++ b/emacs/radian.el @@ -3963,10 +3963,17 @@ bizarre reason." (func &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)))) + (buf (apply func args))) + (or helpful-buffer buf)))) (radian-defadvice radian--advice-fill-elisp-docstrings-correctly (&rest _) :before-until #'fill-context-prefix