GNU bug report logs - #64656
29.0.91; Doc of minibuffer histories and completing-read - automatic addition of completions to DEFAULT list

Previous Next

Package: emacs;

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


Message #80 received at 64656 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 64656 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>,
 drew.adams <at> oracle.com
Subject: Re: bug#64656: 29.0.91; Doc of minibuffer histories and
 completing-read - automatic addition of completions to DEFAULT list
Date: Sun, 12 Nov 2023 10:13:10 +0200
[Message part 1 (text/plain, inline)]
>> I'm trying various completions after customizing completions-sort to nil,
>> so currently noticed a problem in the completions of file names.
>
> So you agree that the problem is wider than that?

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.  There is no such problem for
`C-x C-f M-n M-n' because the list of default values is truncated
explicitly in `read-file-name-default' by

  (minibuffer-with-setup-hook
      (lambda ()
        (setq-local minibuffer-default-add-function
          ...

So maybe to use the same to truncate the list of default values
for `C-h f', `C-h v', `C-h o'?

[minibuffer-default-add-function.patch (text/x-diff, inline)]
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index e93c535bbef..4931aeb49cd 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -234,18 +234,21 @@ help-fns--describe-function-or-command-prompt
                                   "Describe function")
                                 fn))
          (enable-recursive-minibuffers t)
-         (val (completing-read
-               prompt
-               #'help--symbol-completion-table
-               (lambda (f) (if want-command
-                          (commandp f)
-                        (or (fboundp f) (get f 'function-documentation))))
-               ;; We used `confirm' for a while because we may want to see the
-               ;; meta-info about a function even if the function itself is not
-               ;; defined, but this use case is too marginal and rarely tested,
-               ;; not worth the trouble (bug#64902).
-               t nil nil
-               (and fn (symbol-name fn)))))
+         (val (minibuffer-with-setup-hook
+                  (lambda ()
+                    (setq-local minibuffer-default-add-function nil))
+                (completing-read
+                 prompt
+                 #'help--symbol-completion-table
+                 (lambda (f) (if want-command
+                                 (commandp f)
+                               (or (fboundp f) (get f 'function-documentation))))
+                 ;; We used `confirm' for a while because we may want to see the
+                 ;; meta-info about a function even if the function itself is not
+                 ;; defined, but this use case is too marginal and rarely tested,
+                 ;; not worth the trouble (bug#64902).
+                 t nil nil
+                 (and fn (symbol-name fn))))))
     (unless (equal val "")
       (setq fn (intern val)))
     ;; These error messages are intended to be less technical for the
@@ -1269,18 +1272,21 @@ describe-variable
 	 (enable-recursive-minibuffers t)
          (orig-buffer (current-buffer))
 	 val)
-     (setq val (completing-read
-                (format-prompt "Describe variable" (and (symbolp v) v))
-                #'help--symbol-completion-table
-                (lambda (vv)
-                  (or (get vv 'variable-documentation)
-                      (and (not (keywordp vv))
-                           ;; Since the variable may only exist in the
-                           ;; original buffer, we have to look for it
-                           ;; there.
-                           (buffer-local-boundp vv orig-buffer))))
-                t nil nil
-                (if (symbolp v) (symbol-name v))))
+     (setq val (minibuffer-with-setup-hook
+                   (lambda ()
+                     (setq-local minibuffer-default-add-function nil))
+                 (completing-read
+                  (format-prompt "Describe variable" (and (symbolp v) v))
+                  #'help--symbol-completion-table
+                  (lambda (vv)
+                    (or (get vv 'variable-documentation)
+                        (and (not (keywordp vv))
+                             ;; Since the variable may only exist in the
+                             ;; original buffer, we have to look for it
+                             ;; there.
+                             (buffer-local-boundp vv orig-buffer))))
+                  t nil nil
+                  (if (symbolp v) (symbol-name v)))))
      (list (if (equal val "")
 	       v (intern val)))))
   (let (file-name
@@ -1876,14 +1882,17 @@ describe-symbol
           (v-or-f (if found v-or-f (function-called-at-point)))
           (found (or found v-or-f))
           (enable-recursive-minibuffers t)
-          (val (completing-read (format-prompt "Describe symbol"
-                                               (and found v-or-f))
-				#'help--symbol-completion-table
-				(lambda (vv)
-                                  (cl-some (lambda (x) (funcall (nth 1 x) vv))
-                                           describe-symbol-backends))
-				t nil nil
-				(if found (symbol-name v-or-f)))))
+          (val (minibuffer-with-setup-hook
+                   (lambda ()
+                     (setq-local minibuffer-default-add-function nil))
+                 (completing-read (format-prompt "Describe symbol"
+                                                 (and found v-or-f))
+				  #'help--symbol-completion-table
+				  (lambda (vv)
+                                    (cl-some (lambda (x) (funcall (nth 1 x) vv))
+                                             describe-symbol-backends))
+				  t nil nil
+				  (if found (symbol-name v-or-f))))))
      (list (if (equal val "")
 	       (or v-or-f "") (intern val)))))
   (let ((help-buffer-under-preparation t))

This bug report was last modified 1 year and 251 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.