From 0b2ccac00751dfc2f7628b1a2496727633cc3db5 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 16 Sep 2024 06:15:15 -0400 Subject: [PATCH] fix(emacs-lisp): lookup docs backend w/o helpful Use `helpful-symbol` if it's present and the symbol at point doesn't represent a cl-type (falling back to `describe-symbol` otherwise). Fix: #8068 --- modules/lang/emacs-lisp/autoload.el | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/lang/emacs-lisp/autoload.el b/modules/lang/emacs-lisp/autoload.el index fd8e0b343..3b9af8585 100644 --- a/modules/lang/emacs-lisp/autoload.el +++ b/modules/lang/emacs-lisp/autoload.el @@ -95,6 +95,15 @@ Intended to replace `lisp-outline-level'." (doom/help-modules (car module) (cadr module) 'visit-dir) (call-interactively #'elisp-def))) +(defun +emacs-lisp--describe-symbol (symbol) + (if (or (not (fboundp 'helpful-symbol)) + (cl-some (lambda (x) (funcall (nth 1 x) symbol)) + describe-symbol-backends)) + (progn + (describe-symbol symbol) + (pop-to-buffer (help-buffer))) + (helpful-symbol symbol))) + ;;;###autoload (defun +emacs-lisp-lookup-documentation (thing) "Lookup THING with `helpful-variable' if it's a variable, `helpful-callable' @@ -117,10 +126,12 @@ if it's callable, `apropos' otherwise." (org-show-hidden-entry)))) 'deferred)) (thing - (funcall (if (fboundp #'helpful-symbol) - #'helpful-symbol - #'describe-symbol) - (intern thing))) + (let ((thing (intern thing))) + (if (and (not (cl-find-class thing)) + (fboundp 'helpful-symbol)) + (helpful-symbol thing) + (describe-symbol thing) + (pop-to-buffer (help-buffer))))) ((call-interactively (if (fboundp #'helpful-at-point) #'helpful-at-point