GNU bug report logs - #79858
[PATCH] Support completion-eager-display in completing-read-multiple

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Spencer Baugh <sbaugh@HIDDEN>; Keywords: patch; Done: Juri Linkov <juri@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 79858 <at> debbugs.gnu.org:


Received: (at 79858) by debbugs.gnu.org; 27 Nov 2025 17:53:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 27 12:53:48 2025
Received: from localhost ([127.0.0.1]:37477 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vOgBf-0002ps-Ht
	for submit <at> debbugs.gnu.org; Thu, 27 Nov 2025 12:53:48 -0500
Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:33971 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <mail@HIDDEN>)
 id 1vOgBc-0002pR-IH
 for 79858 <at> debbugs.gnu.org; Thu, 27 Nov 2025 12:53:45 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date:
 References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:
 Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:
 Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:
 List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=H2XpzFGwt/htK1NiuRkH3Vb0SkJwvgv4Y4niylT18IY=; b=eWtb2BFXVA6nNp7Fa5O2z9CsJj
 E1TJVYnowuCPmEVVcUWNsbxROgoE3snMZz8x0J5A8aVtXkfZD7Z962RLPxaiFqCRMsb97IoCJdFOV
 xmL6TMNYPnbHZLNdU0oBdXsY3euai/EnQDUt1N9jqbtzKqR8wPS3T4xbIrF+KclO+KOg=;
From: Daniel Mendler <mail@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#79858: [PATCH] Support completion-eager-display in
 completing-read-multiple
In-Reply-To: <87ldjrs720.fsf@HIDDEN>
References: <ierqztv9oo5.fsf@HIDDEN> <87ldjrs720.fsf@HIDDEN>
Date: Thu, 27 Nov 2025 18:53:35 +0100
Message-ID: <87fr9z4b1c.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 79858
Cc: Spencer Baugh <sbaugh@HIDDEN>, 79858 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Juri Linkov <juri@HIDDEN> writes:

> close 79858 31.0.50
> thanks
>
>> Make completing-read-multiple do eager display of *Completions*
>> when the table requests it.
>>
>> As a side-effect of the implementation, we now check again if
>> eager-display is enabled if we have to retry doing eager-display due to
>> being interrupted by user input.  This is mildly nicer since it gives
>> the completion table a little more control: for example, maybe the table
>> only wants to do eager-display if the minibuffer is empty; this change
>> makes that work better.  I don't have an actual use case for this part
>> of the change, it just makes the code nicer and seems reasonable, so if
>> other disagree with this part, I can implement it a different way.
>
> Thanks, since Daniel has no comments, this is pushed now
> (after testing and fixing a stray paren).

Thanks. Somewhat related to the patch - I think it would be neat if we
could implement completing-read-multiple such that it calls
completing-read directly, instead of (partially) replicating the
minibuffer setup.

Daniel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79858; Package emacs. Full text available.
bug marked as fixed in version 31.0.50, send any further explanations to 79858 <at> debbugs.gnu.org and Spencer Baugh <sbaugh@HIDDEN> Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 79858 <at> debbugs.gnu.org:


Received: (at 79858) by debbugs.gnu.org; 27 Nov 2025 17:46:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 27 12:46:59 2025
Received: from localhost ([127.0.0.1]:37457 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vOg55-0002WX-18
	for submit <at> debbugs.gnu.org; Thu, 27 Nov 2025 12:46:59 -0500
Received: from mout-p-202.mailbox.org ([80.241.56.172]:45774)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>)
 id 1vOg53-0002W9-40; Thu, 27 Nov 2025 12:46:58 -0500
Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4dHP4m48CDz9tMd;
 Thu, 27 Nov 2025 18:46:48 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; 
 t=1764265608;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=4NS1hV1bvpqUDBXav1OccEIBJAEVAEG7QJibnrd7Dio=;
 b=vHT4IWatXPXO40r9prl2nly/tLYFRzslQbvZ0MJUxf+jsKCw7qepqIx4Yh7Nxy+l832HLj
 l9U3xWK4trlvQVffLJViv4j3kUeKqfr3AWV2tNbvo8pTLLSXD7gKnj1D20N+j3QjmbJat7
 O60OBSobnc/F/8chNoBVtJuaX23oQXezd3yr4vsrapXUSq3mjoGzoKOu5HdJvOBHN5TqDc
 1Mj9zRk8WkcC1A3HFWvNxirLYARZxF9jHTl0+eVxh0JcorxRm9Y7y6hSuCgwCCofXMpGuc
 54z9G1Mo7tKLP1fnmi0atRPYzIngiiRK70hBllvJg0h4XxgCv9sMdqdZG+BsWg==
From: Juri Linkov <juri@HIDDEN>
To: Spencer Baugh <sbaugh@HIDDEN>
Subject: Re: bug#79858: [PATCH] Support completion-eager-display in
 completing-read-multiple
In-Reply-To: <ierqztv9oo5.fsf@HIDDEN>
Organization: LINKOV.NET
References: <ierqztv9oo5.fsf@HIDDEN>
Date: Thu, 27 Nov 2025 19:45:43 +0200
Message-ID: <87ldjrs720.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 79858
Cc: Daniel Mendler <mail@HIDDEN>, 79858 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

close 79858 31.0.50
thanks

> Make completing-read-multiple do eager display of *Completions*
> when the table requests it.
>
> As a side-effect of the implementation, we now check again if
> eager-display is enabled if we have to retry doing eager-display due to
> being interrupted by user input.  This is mildly nicer since it gives
> the completion table a little more control: for example, maybe the table
> only wants to do eager-display if the minibuffer is empty; this change
> makes that work better.  I don't have an actual use case for this part
> of the change, it just makes the code nicer and seems reasonable, so if
> other disagree with this part, I can implement it a different way.

Thanks, since Daniel has no comments, this is pushed now
(after testing and fixing a stray paren).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79858; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Nov 2025 18:33:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 18 13:33:17 2025
Received: from localhost ([127.0.0.1]:59250 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vLQVw-0002pz-U9
	for submit <at> debbugs.gnu.org; Tue, 18 Nov 2025 13:33:17 -0500
Received: from lists.gnu.org ([2001:470:142::17]:39120)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>)
 id 1vLQVt-0002pQ-Ep
 for submit <at> debbugs.gnu.org; Tue, 18 Nov 2025 13:33:15 -0500
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 <sbaugh@HIDDEN>)
 id 1vLQVi-0008Lg-VK
 for bug-gnu-emacs@HIDDEN; Tue, 18 Nov 2025 13:33:03 -0500
Received: from mxout5.mail.janestreet.com ([64.215.233.18])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>)
 id 1vLQVg-0001aY-IF
 for bug-gnu-emacs@HIDDEN; Tue, 18 Nov 2025 13:33:02 -0500
From: Spencer Baugh <sbaugh@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Support completion-eager-display in completing-read-multiple
X-Debbugs-Cc: Daniel Mendler <mail@HIDDEN>, Juri Linkov
 <juri@HIDDEN>
Date: Tue, 18 Nov 2025 13:32:58 -0500
Message-ID: <ierqztv9oo5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com;
 s=waixah; t=1763490778;
 bh=NgupOdJixqc8p2h6R+rrJo7r+rrkicMbQbuWAKdWvl8=;
 h=From:To:Subject:Date;
 b=Ua/KUcIfHyECpyIYop8Z++a0CMYJ6fmHiMkebSHm8ex8kaO7MB8auq7rTrEivRmqT
 v0XWMTujlKBOB7P6XzIRsDgJRFLXjNTTJrqSjIPfne1RKtJXIQvS9RqReS8azw/Ljg
 unTykU8s/6lleCOF4lEj28vKbszcCATjtUEHE9UdCkjpUdqivKx5zr2ALFtXfOZhif
 Na6EW1HlfwPS49DdTT0L4TtY/YH/VU3SjF1L9bkPeQe6/tlcloXrWPrwCffN1MT0uI
 xQ2jT9rul1j3KhW90EPWvSANX4n9u8CPNdjtBHcXPAwBq5vDNq8nny53HH1QzHNVTM
 Xj/SW5pzZoGVw==
Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@HIDDEN;
 helo=mxout5.mail.janestreet.com
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)

--=-=-=
Content-Type: text/plain

Tags: patch


Make completing-read-multiple do eager display of *Completions*
when the table requests it.

As a side-effect of the implementation, we now check again if
eager-display is enabled if we have to retry doing eager-display due to
being interrupted by user input.  This is mildly nicer since it gives
the completion table a little more control: for example, maybe the table
only wants to do eager-display if the minibuffer is empty; this change
makes that work better.  I don't have an actual use case for this part
of the change, it just makes the code nicer and seems reasonable, so if
other disagree with this part, I can implement it a different way.

In GNU Emacs 30.1.90 (build 82, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2025-11-17 built on
 igm-qws-u22796a
Repository revision: 148b5dccc24162d8e20f7239ef76b995ec6bfa7e
Repository branch: emacs-30
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Rocky Linux 8.10 (Green Obsidian)

Configured using:
 'configure --with-x-toolkit=lucid --without-gpm --without-gconf
 --without-selinux --without-imagemagick --with-modules --with-gif=no
 --with-cairo --with-rsvg --without-compress-install --with-tree-sitter
 --with-native-compilation=aot
 PKG_CONFIG_PATH=/usr/local/home/garnish/libtree-sitter/0.22.6-1/lib/pkgconfig/'


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-Support-completion-eager-display-in-completing-read-.patch

From 4c29d4c05e2919896375c2c976b193c76bae74be Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@HIDDEN>
Date: Tue, 18 Nov 2025 13:28:29 -0500
Subject: [PATCH] Support completion-eager-display in completing-read-multiple

Make completing-read-multiple do eager display of *Completions*
when the table requests it.

As a side-effect of the implementation, we now check again if
eager-display is enabled if we have to retry doing eager-display
due to being interrupted by user input.  This is mildly nicer
since it gives the completion table a little more control: for
example, maybe the table only wants to do eager-display if the
minibuffer is empty; this change makes that work better.

* lisp/minibuffer.el (completions--start-eager-display)
(completing-read-default): Move the code for checking whether to
do eager-display into completions--start-eager-display.
* lisp/emacs-lisp/crm.el (completing-read-multiple): Call
completions--start-eager-display.
---
 lisp/emacs-lisp/crm.el |  3 ++-
 lisp/minibuffer.el     | 29 ++++++++++++++---------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el
index 425a606cb12..f1e5e4fc63e 100644
--- a/lisp/emacs-lisp/crm.el
+++ b/lisp/emacs-lisp/crm.el
@@ -285,7 +285,8 @@ completing-read-multiple
                       (unless (eq require-match t) require-match))
           (setq-local minibuffer--require-match require-match)
           (setq-local minibuffer--original-buffer buffer)
-          (setq-local crm-completion-table table))
+          (setq-local crm-completion-table table)
+          (completions--start-eager-display))
       (setq input (read-from-minibuffer
                    (format-spec
                     crm-prompt
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 0ebef1c1394..7a4117b26dd 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2767,9 +2767,19 @@ completions--eager-display
       (completions--start-eager-display))))
 
 (defun completions--start-eager-display ()
-  "Display the *Completions* buffer when the user is next idle."
-  (setq completion-eager-display--timer
-        (run-with-idle-timer 0 nil #'completions--eager-display)))
+  "Maybe display the *Completions* buffer when the user is next idle.
+
+Only displays if `completion-eager-display' is t, or if eager display
+has been requested by the completion table."
+  (when completion-eager-display
+    (when (or (eq completion-eager-display t)
+              (completion-metadata-get
+               (completion-metadata
+                (buffer-substring-no-properties (minibuffer-prompt-end) (point))
+                minibuffer-completion-table minibuffer-completion-predicate)
+               'eager-display))
+      (setq completion-eager-display--timer
+            (run-with-idle-timer 0 nil #'completions--eager-display)))))
 
 (defun completions--post-command-update ()
   "Update displayed *Completions* buffer after command, once."
@@ -5156,18 +5166,7 @@ completing-read-default
                 (setq-local minibuffer--original-buffer buffer)
                 ;; Copy the value from original buffer to the minibuffer.
                 (setq-local completion-ignore-case c-i-c)
-                ;; Show the completion help eagerly if
-                ;; `completion-eager-display' is t or if eager display
-                ;; has been requested by the completion table.
-                (when completion-eager-display
-                  (when (or (eq completion-eager-display t)
-                            (completion-metadata-get
-                             (completion-metadata
-                              (buffer-substring-no-properties
-                               (minibuffer-prompt-end) (point))
-                              collection predicate)
-                             'eager-display))
-                    (completions--start-eager-display))))
+                (completions--start-eager-display)))
             (read-from-minibuffer prompt initial-input keymap
                                   nil hist def inherit-input-method))))
     (when (and (equal result "") def)
-- 
2.43.7


--=-=-=--




Acknowledgement sent to Spencer Baugh <sbaugh@HIDDEN>:
New bug report received and forwarded. Copy sent to mail@HIDDEN, juri@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to mail@HIDDEN, juri@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#79858; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 27 Nov 2025 18:00:01 UTC

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