From 1f6fd7ee99b3807e012d366d71679ae917cac096 Mon Sep 17 00:00:00 2001 From: Arthur Miller Date: Wed, 15 Sep 2021 12:40:34 +0200 Subject: [PATCH] Load symbols when docs are not present in autoloads * lisp/help-fns.el ('help-enable-symbol-autoload'): New option. * lisp/help.el (help-function-arglist): Check if docs are present in autoload object, and perform autoload if they are not. --- lisp/help-fns.el | 6 ++++++ lisp/help.el | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index a7219ede94..842bcb39fe 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -132,6 +132,12 @@ help-enable-completion-autoload :group 'help :version "26.3") +(defcustom help-enable-symbol-autoload nil + "Perform autoload when documentation is not present in autoload object." + :type 'boolean + :group 'help + :version "28.1") + (defun help--symbol-class (s) "Return symbol class characters for symbol S." (when (stringp s) diff --git a/lisp/help.el b/lisp/help.el index 29ae340481..9b6ae0c821 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1883,6 +1883,10 @@ help-function-arglist "Return a formal argument list for the function DEF. If PRESERVE-NAMES is non-nil, return a formal arglist that uses the same names as used in the original source code, when possible." + ;; Load docs for autoloads when doc is missing. + (if (and (autoloadp def) (not (nth 2 def)) help-enable-symbol-autoload + (not (and (nth 4 def) (eq (nth 4 def) 'keymap)))) + (autoload-do-load def)) ;; Handle symbols aliased to other symbols. (if (and (symbolp def) (fboundp def)) (setq def (indirect-function def))) ;; Advice wrappers have "catch all" args, so fetch the actual underlying -- 2.33.0