emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master ff1f82cbe3f: * lisp/simple.el (minibuffer-default-add-completions


From: Juri Linkov
Subject: master ff1f82cbe3f: * lisp/simple.el (minibuffer-default-add-completions): Improve (bug#64656).
Date: Wed, 15 Nov 2023 12:53:08 -0500 (EST)

branch: master
commit ff1f82cbe3fa9aee354581f2798faaae7163ea44
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/simple.el (minibuffer-default-add-completions): Improve (bug#64656).
    
    Return nil for some popular completions with undefined order that include
    obarray.  Extend the docstring to explain how to disable this feature.
---
 lisp/simple.el | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index f86b3f9e208..02005e3b4f9 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2989,11 +2989,17 @@ this by calling a function defined by 
`minibuffer-default-add-function'.")
 (defun minibuffer-default-add-completions ()
   "Return a list of all completions without the default value.
 This function is used to add all elements of the completion table to
-the end of the list of defaults just after the default value."
+the end of the list of defaults just after the default value.
+When you don't want to add initial completions to the default value,
+you can use either `minibuffer-setup-hook' or `minibuffer-with-setup-hook'
+to set the value of `minibuffer-default-add-function' to nil."
   (let ((def minibuffer-default)
-       (all (all-completions ""
-                             minibuffer-completion-table
-                             minibuffer-completion-predicate)))
+        ;; Avoid some popular completions with undefined order
+        (all (unless (memq minibuffer-completion-table
+                           `(help--symbol-completion-table ,obarray))
+               (all-completions ""
+                                minibuffer-completion-table
+                                minibuffer-completion-predicate))))
     (if (listp def)
        (append def all)
       (cons def (delete def all)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]