GNU bug report logs -
#64656
29.0.91; Doc of minibuffer histories and completing-read - automatic addition of completions to DEFAULT list
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Sat, 15 Jul 2023 23:36:01 UTC
Severity: minor
Found in version 29.0.91
Fixed in version 30.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
>> > The problem reported by this bug report is that the order is random by
>> > `C-h v M-n M-n' because it uses obarray.
>
> No. That is NOT the problem reported. The problem
> reported is:
>
> 1. Initial completions are added to `M-n' automatically,
> instead of just by a user adding them explicitly to
> DEFAULTS.
>
> 2. Given that BUG, _IF_ it won't be fixed, then the doc
> should at least make users aware of it and mention
> how to work around it.
>
> Fixing #1 is preferable. Fixing #2 is minimal damage
> control, IF you won't fix #1.
#1 can be fixed only partially for some popular obarray completions.
So here is a patch that fixes #1 partially and #2 completely.
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 @@ minibuffer-default-add-done
(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)))))
This bug report was last modified 1 year and 249 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.