* lisp/help-fns.el (help-fns--setup-xref-backend):
New function (bug#69462).
(describe-function, describe-variable): Use it here.
* lisp/emacs-lisp/cl-extra.el (cl-describe-type): And here.
* lisp/progmodes/elisp-mode.el (xref-backend-definitions):
Only infer namespace in emacs-lisp-mode (use 'any' otherwise).
(cherry picked from commit
c8ecd7fa0da8a597250989430ac2b2465419f18e)
Call `cl--find-class' to get TYPE's propname `cl--class'"
(cl--find-class type))
+(declare-function help-fns--setup-xref-backend "help-fns" ())
+
;;;###autoload
(defun cl-describe-type (type &optional _buf _frame)
"Display the documentation for type TYPE (a symbol)."
;; cl-deftype).
(user-error "Unknown type %S" type))))
(with-current-buffer standard-output
+ (help-fns--setup-xref-backend)
;; Return the text we displayed.
(buffer-string)))))
fn))
(list fn)))
+(defun help-fns--setup-xref-backend ()
+ (add-hook 'xref-backend-functions #'elisp--xref-backend nil t)
+ (setq-local project-vc-external-roots-function #'elisp-load-path-roots)
+ (setq-local grep-filepattern-alist '((help-mode "*.el"))))
+
;;;###autoload
(defun describe-function (function)
"Display the full documentation of FUNCTION (a symbol).
(princ " is ")
(describe-function-1 function)
(with-current-buffer standard-output
+ (help-fns--setup-xref-backend)
+
;; Return the text we displayed.
(buffer-string))))))
(delete-char 1)))))
(with-current-buffer standard-output
+ (help-fns--setup-xref-backend)
;; Return the text we displayed.
(buffer-string))))))))
(let ((sym (intern-soft identifier)))
(when sym
(let* ((pos (get-text-property 0 'pos identifier))
- (namespace (if pos
+ (namespace (if (and pos
+ ;; Reusing it in Help Mode.
+ (derived-mode-p 'emacs-lisp-mode))
(elisp--xref-infer-namespace pos)
'any))
(defs (elisp--xref-find-definitions sym)))