From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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 Organization: LINKOV.NET Message-ID: <864jhrwfad.fsf@mail.linkov.net> References: <83y1jga0nr.fsf@gnu.org> <83o7kb9a40.fsf@gnu.org> <86bkg84de3.fsf@mail.linkov.net> <86jzrhlrub.fsf_-_@mail.linkov.net> <867cmw83zb.fsf@mail.linkov.net> <867cmvcpco.fsf@mail.linkov.net> <86a5rmanrn.fsf@mail.linkov.net> <83edgyzxcx.fsf@gnu.org> <86jzqqj1u2.fsf@mail.linkov.net> <838r76zpsw.fsf@gnu.org> <86v8aakq69.fsf@mail.linkov.net> <83sf5exbv2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="846"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 64656@debbugs.gnu.org, Stefan Monnier , drew.adams@oracle.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 12 09:33:41 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r25uX-00006d-DI for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Nov 2023 09:33:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r25uF-00018N-Ma; Sun, 12 Nov 2023 03:33:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r25uD-0000zf-AA for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 03:33:21 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r25uD-0002Ho-1c for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 03:33:21 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r25ur-0000m4-R6 for bug-gnu-emacs@gnu.org; Sun, 12 Nov 2023 03:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Nov 2023 08:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64656 X-GNU-PR-Package: emacs Original-Received: via spool by 64656-submit@debbugs.gnu.org id=B64656.16997780222949 (code B ref 64656); Sun, 12 Nov 2023 08:34:01 +0000 Original-Received: (at 64656) by debbugs.gnu.org; 12 Nov 2023 08:33:42 +0000 Original-Received: from localhost ([127.0.0.1]:55085 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r25uY-0000lU-BF for submit@debbugs.gnu.org; Sun, 12 Nov 2023 03:33:42 -0500 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:37521) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r25uW-0000l6-Ki for 64656@debbugs.gnu.org; Sun, 12 Nov 2023 03:33:41 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 3145D240003; Sun, 12 Nov 2023 08:32:51 +0000 (UTC) In-Reply-To: <83sf5exbv2.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 10 Nov 2023 10:15:45 +0200") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274189 Archived-At: --=-=-= Content-Type: text/plain >> 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'? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=minibuffer-default-add-function.patch 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)) --=-=-=--