unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 64656@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>,
	drew.adams@oracle.com
Subject: 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	[thread overview]
Message-ID: <864jhrwfad.fsf@mail.linkov.net> (raw)
In-Reply-To: <83sf5exbv2.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 10 Nov 2023 10:15:45 +0200")

[-- Attachment #1: Type: text/plain, Size: 661 bytes --]

>> 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'?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: minibuffer-default-add-function.patch --]
[-- Type: text/x-diff, Size: 4776 bytes --]

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))

  reply	other threads:[~2023-11-12  8:13 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-15 23:35 bug#64656: 29.0.91; Doc of minibuffer histories and completing-read - automatic addition of completions to DEFAULT list Drew Adams
2023-07-16  5:24 ` Eli Zaretskii
2023-07-16 14:34   ` Drew Adams
2023-07-16 14:58     ` Eli Zaretskii
2023-07-18 20:27       ` Drew Adams
2023-07-19  6:35         ` Juri Linkov
2023-07-19 17:23           ` Drew Adams
2023-10-20  6:47             ` Juri Linkov
2023-10-20 16:48               ` Drew Adams
2023-10-29 18:29                 ` Juri Linkov
2023-10-29 22:15                   ` Drew Adams
2023-10-30  7:44                     ` Juri Linkov
2023-11-13 18:14                       ` Drew Adams
2023-11-14  5:57                         ` Thierry Volpiatto
2023-11-14  7:28                         ` Juri Linkov
2023-11-05 18:11               ` Juri Linkov
2023-11-06  7:28                 ` Juri Linkov
2023-11-09 16:34                   ` Juri Linkov
2023-11-09 16:48                     ` Eli Zaretskii
2023-11-09 17:03                       ` Juri Linkov
2023-11-09 19:31                         ` Eli Zaretskii
2023-11-10  7:45                           ` Juri Linkov
2023-11-10  8:15                             ` Eli Zaretskii
2023-11-12  8:13                               ` Juri Linkov [this message]
2023-11-13 17:17                                 ` Juri Linkov
2023-11-13 18:14                                   ` Drew Adams
2023-11-14  7:30                                     ` Juri Linkov
2023-11-15 17:52                                       ` Juri Linkov
2023-11-10 19:51                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-20  6:19         ` Eli Zaretskii
2023-07-20 16:45           ` Drew Adams
2023-07-22  8:07             ` Eli Zaretskii
2023-07-16 13:40 ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=864jhrwfad.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=64656@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).