From 2e3d84fc1d8457046a0aceed7e1f9837330a4365 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 15 May 2019 20:29:38 -0400 Subject: [PATCH] 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. * etc/NEWS: Announce it. --- etc/NEWS | 6 ++++++ lisp/help-fns.el | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 573c8236b2..286f9ee275 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -24,6 +24,12 @@ with a prefix argument or by typing 'C-u C-h C-n'. * 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 diff --git a/lisp/help-fns.el b/lisp/help-fns.el index a7812e3b4b..8684a853af 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -89,11 +89,23 @@ help--load-prefixes (unless (help--loaded-p file) (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) - (let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string))) - (help--load-prefixes prefixes)) + (when help-enable-completion-auto-load + (let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string))) + (help--load-prefixes prefixes))) (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 (if pred (lambda (sym) (or (funcall pred sym) -- 2.11.0