Add option to disable help completion autoloading (Bug#28607)
* lisp/help-fns.el (help-enable-completion-auto-load): New option. (help--symbol-completion-table): Consult it. * doc/emacs/building.texi (Lisp Libraries): Document it. * etc/NEWS: Announce it. * doc/lispref/loading.texi (Autoload by Prefix): New section. (Autoload): Reference it.
This commit is contained in:
parent
122ba16890
commit
400907b3c1
4 changed files with 49 additions and 4 deletions
|
@ -1499,6 +1499,12 @@ library lets Emacs properly set up the hyperlinks in the @file{*Help*}
|
||||||
buffer). To disable this feature, change the variable
|
buffer). To disable this feature, change the variable
|
||||||
@code{help-enable-auto-load} to @code{nil}.
|
@code{help-enable-auto-load} to @code{nil}.
|
||||||
|
|
||||||
|
@vindex help-enable-completion-auto-load
|
||||||
|
Automatic loading also occurs when completing names for
|
||||||
|
@code{describe-variable} and @code{describe-function}, based on the
|
||||||
|
prefix being completed. To disable this feature, change the variable
|
||||||
|
@code{help-enable-completion-auto-load} to @code{nil}.
|
||||||
|
|
||||||
@vindex load-dangerous-libraries
|
@vindex load-dangerous-libraries
|
||||||
@cindex Lisp files byte-compiled by XEmacs
|
@cindex Lisp files byte-compiled by XEmacs
|
||||||
By default, Emacs refuses to load compiled Lisp files which were
|
By default, Emacs refuses to load compiled Lisp files which were
|
||||||
|
|
|
@ -466,9 +466,11 @@ first call to the function automatically loads the proper library, in
|
||||||
order to install the real definition and other associated code, then
|
order to install the real definition and other associated code, then
|
||||||
runs the real definition as if it had been loaded all along.
|
runs the real definition as if it had been loaded all along.
|
||||||
Autoloading can also be triggered by looking up the documentation of
|
Autoloading can also be triggered by looking up the documentation of
|
||||||
the function or macro (@pxref{Documentation Basics}).
|
the function or macro (@pxref{Documentation Basics}), and completion
|
||||||
|
of variable and function names (@pxref{Autoload by Prefix} below).
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
|
* Autoload by Prefix:: Autoload by Prefix.
|
||||||
* When to Autoload:: When to Use Autoload.
|
* When to Autoload:: When to Use Autoload.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
|
@ -703,6 +705,25 @@ symbol's new function value. If the value of the optional argument
|
||||||
function, only a macro.
|
function, only a macro.
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
|
@node Autoload by Prefix
|
||||||
|
@subsection Autoload by Prefix
|
||||||
|
@cindex autoload by prefix
|
||||||
|
|
||||||
|
@vindex definition-prefixes
|
||||||
|
@findex register-definition-prefixes
|
||||||
|
@vindex autoload-compute-prefixes
|
||||||
|
During completion for the commands @code{describe-variable} and
|
||||||
|
@code{describe-function}, Emacs will try to load files which may
|
||||||
|
contain definitions matching the prefix being completed. The variable
|
||||||
|
@code{definition-prefixes} holds a hashtable which maps a prefix to
|
||||||
|
the corresponding list of files to load for it. Entries to this
|
||||||
|
mapping are added by calls to @code{register-definition-prefixes}
|
||||||
|
which are generated by @code{update-file-autoloads}
|
||||||
|
(@pxref{Autoload}). Files which don't contain any definitions worth
|
||||||
|
loading (test files, for examples), should set
|
||||||
|
@code{autoload-compute-prefixes} to @code{nil} as a file-local
|
||||||
|
variable.
|
||||||
|
|
||||||
@node When to Autoload
|
@node When to Autoload
|
||||||
@subsection When to Use Autoload
|
@subsection When to Use Autoload
|
||||||
@cindex autoload, when to use
|
@cindex autoload, when to use
|
||||||
|
|
6
etc/NEWS
6
etc/NEWS
|
@ -24,6 +24,12 @@ with a prefix argument or by typing 'C-u C-h C-n'.
|
||||||
|
|
||||||
* Changes in Emacs 26.3
|
* Changes in Emacs 26.3
|
||||||
|
|
||||||
|
+++
|
||||||
|
** New option 'help-enable-completion-auto-load'.
|
||||||
|
This allows disabling the new feature introduced in Emacs 26.1 which
|
||||||
|
loads files during completion of 'C-h f' and 'C-h v' according to
|
||||||
|
'definition-prefixes'.
|
||||||
|
|
||||||
|
|
||||||
* Editing Changes in Emacs 26.3
|
* Editing Changes in Emacs 26.3
|
||||||
|
|
||||||
|
|
|
@ -89,11 +89,23 @@ The functions will receive the function name as argument.")
|
||||||
(unless (help--loaded-p file)
|
(unless (help--loaded-p file)
|
||||||
(load file 'noerror 'nomessage)))))
|
(load file 'noerror 'nomessage)))))
|
||||||
|
|
||||||
|
(defcustom help-enable-completion-auto-load t
|
||||||
|
"Whether completion for Help commands can perform autoloading.
|
||||||
|
If non-nil, whenever invoking completion for `describe-function'
|
||||||
|
or `describe-variable' load files that might contain definitions
|
||||||
|
with the current prefix. The files are chosen according to
|
||||||
|
`definition-prefixes'."
|
||||||
|
:type 'boolean
|
||||||
|
:group 'help
|
||||||
|
:version "26.3")
|
||||||
|
|
||||||
(defun help--symbol-completion-table (string pred action)
|
(defun help--symbol-completion-table (string pred action)
|
||||||
(let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string)))
|
(when help-enable-completion-auto-load
|
||||||
(help--load-prefixes prefixes))
|
(let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string)))
|
||||||
|
(help--load-prefixes prefixes)))
|
||||||
(let ((prefix-completions
|
(let ((prefix-completions
|
||||||
(mapcar #'intern (all-completions string definition-prefixes))))
|
(and help-enable-completion-auto-load
|
||||||
|
(mapcar #'intern (all-completions string definition-prefixes)))))
|
||||||
(complete-with-action action obarray string
|
(complete-with-action action obarray string
|
||||||
(if pred (lambda (sym)
|
(if pred (lambda (sym)
|
||||||
(or (funcall pred sym)
|
(or (funcall pred sym)
|
||||||
|
|
Loading…
Add table
Reference in a new issue