From: Eshel Yaron Date: Sat, 24 Aug 2024 11:11:56 +0000 (+0200) Subject: (help-enable-completion-autoload): Deprecate. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=28af7d2186ea1b3bc1d86f4904c4f2151227ba6d;p=emacs.git (help-enable-completion-autoload): Deprecate. --- diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 1b079c2cef9..bbe09ac3162 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -1660,12 +1660,6 @@ library lets Emacs properly set up the hyperlinks in the @file{*Help*} buffer). To disable this feature, change the variable @code{help-enable-autoload} to @code{nil}. -@vindex help-enable-completion-autoload -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-autoload} to @code{nil}. - Once you put your library in a directory where Emacs can find and load it, you may wish to make it available at startup. This is useful when the library defines features that should be available diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 6b4e4ad48f7..4114fb550bf 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -73,65 +73,8 @@ current help buffer.") ;; Functions -(defvar help-definition-prefixes nil - ;; FIXME: We keep `definition-prefixes' as a hash-table so as to - ;; avoid pre-loading radix-tree and because it takes slightly less - ;; memory. But when we use this table it's more efficient to - ;; represent it as a radix tree, since the main operation is to do - ;; `radix-tree-prefixes'. Maybe we should just bite the bullet and - ;; use a radix tree for `definition-prefixes' (it's not *that* - ;; costly, really). - "Radix-tree representation replacing `definition-prefixes'.") - -(defun help-definition-prefixes () - "Return the up-to-date radix-tree form of `definition-prefixes'." - (when (and (null help-definition-prefixes) - (> (hash-table-count definition-prefixes) 0)) - (maphash (lambda (prefix files) - (let ((old (radix-tree-lookup help-definition-prefixes prefix))) - (setq help-definition-prefixes - (radix-tree-insert help-definition-prefixes - prefix (append old files))))) - definition-prefixes)) - help-definition-prefixes) - -(defun help--loaded-p (file) - "Try and figure out if FILE has already been loaded." - ;; FIXME: this regexp business is not good enough: for file - ;; `toto', it will say `toto' is loaded when in reality it was - ;; just cedet/semantic/toto that has been loaded. - (or (let ((feature (intern-soft file))) - (and feature (featurep feature))) - (let* ((re (load-history-regexp file)) - (done nil)) - (dolist (x load-history) - (and (stringp (car x)) (string-match-p re (car x)) (setq done t))) - done))) - -(defun help--load-prefixes (prefixes) - (pcase-dolist (`(,prefix . ,files) prefixes) - (setq help-definition-prefixes - (radix-tree-insert help-definition-prefixes prefix nil)) - (dolist (file files) - ;; FIXME: Should we scan help-definition-prefixes to remove - ;; other prefixes of the same file? - (unless (help--loaded-p file) - (with-demoted-errors "while loading: %S" - (load file 'noerror 'nomessage)))))) - - -(define-obsolete-variable-alias 'help-enable-completion-auto-load - 'help-enable-completion-autoload "27.1") - -(defcustom help-enable-completion-autoload 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") +(defvar help-enable-completion-autoload nil "Unused obsolete variable.") +(make-obsolete-variable 'help-enable-completion-autoload nil "31.1") (defcustom help-enable-variable-value-editing nil "If non-nil, allow editing values in *Help* buffers. @@ -249,16 +192,7 @@ type specifier when available." (narrow-completions-function . ((?p "property" "Symbol property" help--symbol-narrow-by-property) (?f "file" "Symbol file" help--symbol-narrow-by-file)))) - (when help-enable-completion-autoload - (let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string))) - (help--load-prefixes prefixes))) - (let ((prefix-completions - (and help-enable-completion-autoload - (mapcar #'intern (all-completions string definition-prefixes))))) - (complete-with-action action obarray string - (if pred (lambda (sym) - (or (funcall pred sym) - (memq sym prefix-completions)))))))) + (complete-with-action action obarray string pred))) (defvar describe-function-orig-buffer nil "Buffer that was current when `describe-function' was invoked.