GNU bug report logs - #74865
[PATCH] Use `completion-table-with-metadata'

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: Daniel Mendler <mail@HIDDEN>; Keywords: patch; Done: Juri Linkov <juri@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 31.0.50, send any further explanations to 74865 <at> debbugs.gnu.org and Daniel Mendler <mail@HIDDEN> Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 74865) by debbugs.gnu.org; 3 Feb 2025 18:34:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 03 13:34:05 2025
Received: from localhost ([127.0.0.1]:41190 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tf1Gn-0006hD-2V
	for submit <at> debbugs.gnu.org; Mon, 03 Feb 2025 13:34:05 -0500
Received: from relay2-d.mail.gandi.net ([217.70.183.194]:46175)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>)
 id 1tf1Gk-0006gd-O2; Mon, 03 Feb 2025 13:34:03 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id A4E4841B45;
 Mon,  3 Feb 2025 18:33:55 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
Subject: Re: bug#74865: [PATCH] Use `completion-table-with-metadata'
In-Reply-To: <87v7tr5rpr.fsf@HIDDEN> (Daniel Mendler's message of
 "Mon, 03 Feb 2025 09:59:28 +0100")
Organization: LINKOV.NET
References: <87o71eifrs.fsf@HIDDEN>
 <87r04f5uw9.fsf@HIDDEN> <87v7tr5rpr.fsf@HIDDEN>
Date: Mon, 03 Feb 2025 20:33:28 +0200
Message-ID: <87bjvi3mkn.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddukeeffecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghofhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuggftrfgrthhtvghrnhepffegteefveelhfeljeefueehieduiedtfffhuddtkeeffffghfevheetgeeukeehnecukfhppeeluddruddvledrleeirdeltdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeluddruddvledrleeirdeltddphhgvlhhopehmrghilhdrghgrnhguihdrnhgvthdpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnsggprhgtphhtthhopeegpdhrtghpthhtoheptghonhhtrhholhesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrghdprhgtphhtthhopeejgeekieehseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepmhgrihhlsegurghnihgvlhdqmhgvnhgulhgvrhdruggv
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 74865
Cc: Eli Zaretskii <eliz@HIDDEN>, 74865 <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 74865 31.0.50
thanks

>> This change removed affixation-function from another if-branch in 'read-face-name'
>> for the case when 'multiple' is t that uses completing-read-multiple:
>
> I have attached a patch to this mail which corrects this. Please give it
> a test. Thank you!

Thanks, I confirm everything works correctly, so now pushed.




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

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


Received: (at 74865) by debbugs.gnu.org; 3 Feb 2025 08:59:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 03 03:59:39 2025
Received: from localhost ([127.0.0.1]:37729 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tesIt-00023L-DH
	for submit <at> debbugs.gnu.org; Mon, 03 Feb 2025 03:59:39 -0500
Received: from server.qxqx.de ([2a01:4f8:c012:9177::1]:41343 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 1tesIq-000230-Ic
 for 74865 <at> debbugs.gnu.org; Mon, 03 Feb 2025 03:59:37 -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=JZ+vPyeE6QBn3lPJ1AZ9oLpZ/oy8EcfXhxLMa7dH5fM=; b=bVCwqQUEkglIASGrnWLWcQVzpk
 rs6erb9Gdzm8T1zdmqzY/BAl+bhVU3GhG5O/u2fKRg3DFIivzKjRv+3+g5ByEl8EhFjuF5pCSx9Co
 R3pr/QOG/b9d7JkEIqtv9Wt8zenLJ6jT7/KoBlZdPsbd5uM75pJly3MyblPBxrdHfOio=;
From: Daniel Mendler <mail@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#74865: [PATCH] Use `completion-table-with-metadata'
In-Reply-To: <87r04f5uw9.fsf@HIDDEN> (Juri Linkov's message of "Mon, 
 03 Feb 2025 09:50:46 +0200")
References: <87o71eifrs.fsf@HIDDEN> <87r04f5uw9.fsf@HIDDEN>
Date: Mon, 03 Feb 2025 09:59:28 +0100
Message-ID: <87v7tr5rpr.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 74865
Cc: Eli Zaretskii <eliz@HIDDEN>, 74865 <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 (-)

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

Juri Linkov <juri@HIDDEN> writes:

> This change removed affixation-function from another if-branch in 'read-face-name'
> for the case when 'multiple' is t that uses completing-read-multiple:

Hello Juri,

I have attached a patch to this mail which corrects this. Please give it
a test. Thank you!

Daniel


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-read-face-name-Build-common-completion-table-for-CR-.patch

From 50d6f59629f3bc7daf3eb19e52327ff08a08fb23 Mon Sep 17 00:00:00 2001
From: Daniel Mendler <mail@HIDDEN>
Date: Mon, 3 Feb 2025 09:54:47 +0100
Subject: [PATCH] read-face-name: Build common completion table for CR and CRM

* lisp/faces.el (read-face-name): Build a common completion
table for both `completing-read' and `completing-read-multiple'
with completion metadata.
---
 lisp/faces.el | 40 +++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/lisp/faces.el b/lisp/faces.el
index 5fe3ab1a294..dd8c24f5001 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1137,19 +1137,30 @@ read-face-name
     (let ((prompt (if default
                       (format-prompt prompt default)
                     (format "%s: " prompt)))
-          aliasfaces nonaliasfaces faces)
+          aliasfaces nonaliasfaces table)
       ;; Build up the completion tables.
       (mapatoms (lambda (s)
                   (if (facep s)
                       (if (get s 'face-alias)
                           (push (symbol-name s) aliasfaces)
                         (push (symbol-name s) nonaliasfaces)))))
+      (setq table
+            (completion-table-with-metadata
+             (completion-table-in-turn nonaliasfaces aliasfaces)
+             `((affixation-function
+                . ,(lambda (faces)
+                     (mapcar
+                      (lambda (face)
+                        (list face
+                              (concat (propertize read-face-name-sample-text
+                                                  'face face)
+                                      "\t")
+                              ""))
+                      faces))))))
       (if multiple
-          (progn
-            (dolist (face (completing-read-multiple
-                           prompt
-                           (completion-table-in-turn nonaliasfaces aliasfaces)
-                           nil t nil 'face-name-history default))
+          (let (faces)
+            (dolist (face (completing-read-multiple prompt table nil t nil
+                                                    'face-name-history default))
               ;; Ignore elements that are not faces
               ;; (for example, because DEFAULT was "all faces")
               (if (facep face) (push (if (stringp face)
@@ -1157,21 +1168,8 @@ read-face-name
                                        face)
                                      faces)))
             (nreverse faces))
-        (let ((face (completing-read
-                     prompt
-                     (completion-table-with-metadata
-                      (completion-table-in-turn nonaliasfaces aliasfaces)
-                      `((affixation-function
-                        . ,(lambda (faces)
-                             (mapcar
-                              (lambda (face)
-                                (list face
-                                      (concat (propertize read-face-name-sample-text
-                                                          'face face)
-                                              "\t")
-                                      ""))
-                              faces)))))
-                     nil t nil 'face-name-history defaults)))
+        (let ((face (completing-read prompt table nil t nil
+                                     'face-name-history defaults)))
           (when (facep face) (if (stringp face)
                                  (intern face)
                                face)))))))
-- 
2.47.2


--=-=-=--




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

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


Received: (at 74865) by debbugs.gnu.org; 3 Feb 2025 07:58:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 03 02:58:36 2025
Received: from localhost ([127.0.0.1]:37588 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1terLo-0001WD-0p
	for submit <at> debbugs.gnu.org; Mon, 03 Feb 2025 02:58:36 -0500
Received: from relay4-d.mail.gandi.net ([2001:4b98:dc4:8::224]:46065)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1terLl-0001Vr-CA
 for 74865 <at> debbugs.gnu.org; Mon, 03 Feb 2025 02:58:33 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id A041E43396;
 Mon,  3 Feb 2025 07:58:24 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
Subject: Re: bug#74865: [PATCH] Use `completion-table-with-metadata'
In-Reply-To: <87o71eifrs.fsf@HIDDEN> (Daniel Mendler's message of
 "Sat, 14 Dec 2024 13:57:11 +0100")
Organization: LINKOV.NET
References: <87o71eifrs.fsf@HIDDEN>
Date: Mon, 03 Feb 2025 09:50:46 +0200
Message-ID: <87r04f5uw9.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddujedtgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefujghofhffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuggftrfgrthhtvghrnhepffegteefveelhfeljeefueehieduiedtfffhuddtkeeffffghfevheetgeeukeehnecukfhppeeluddruddvledrleeirdeltdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeluddruddvledrleeirdeltddphhgvlhhopehmrghilhdrghgrnhguihdrnhgvthdpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnsggprhgtphhtthhopeefpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohepjeegkeeiheesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehmrghilhesuggrnhhivghlqdhmvghnughlvghrrdguvg
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 74865
Cc: Eli Zaretskii <eliz@HIDDEN>, 74865 <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 (-)

This change removed affixation-function from another if-branch in 'read-face-name'
for the case when 'multiple' is t that uses completing-read-multiple:

> diff --git a/lisp/faces.el b/lisp/faces.el
> index f8ec0f1a187..05df685c679 100644
> --- a/lisp/faces.el
> +++ b/lisp/faces.el
> @@ -1147,17 +1147,6 @@ read-face-name
>      (let ((prompt (if default
>                        (format-prompt prompt default)
>                      (format "%s: " prompt)))
> -          (completion-extra-properties
> -           `(:affixation-function
> -             ,(lambda (faces)
> -                (mapcar
> -                 (lambda (face)
> -                   (list face
> -                         (concat (propertize read-face-name-sample-text
> -                                             'face face)
> -                                 "\t")
> -                         ""))
> -                 faces))))
>            aliasfaces nonaliasfaces faces)
>        ;; Build up the completion tables.
>        (mapatoms (lambda (s)
> @@ -1180,7 +1169,18 @@ read-face-name
>              (nreverse faces))
>          (let ((face (completing-read
>                       prompt
> -                     (completion-table-in-turn nonaliasfaces aliasfaces)
> +                     (completion-table-with-metadata
> +                      (completion-table-in-turn nonaliasfaces aliasfaces)
> +                      `((affixation-function
> +                        . ,(lambda (faces)
> +                             (mapcar
> +                              (lambda (face)
> +                                (list face
> +                                      (concat (propertize read-face-name-sample-text
> +                                                          'face face)
> +                                              "\t")
> +                                      ""))
> +                              faces)))))
>                       nil t nil 'face-name-history defaults)))
>            (when (facep face) (if (stringp face)
>                                   (intern face)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#74865; Package emacs. Full text available.
Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs@HIDDEN> to internal_control <at> debbugs.gnu.org. Full text available.
bug unarchived. Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
bug archived. Request was from Debbugs Internal Request <help-debbugs@HIDDEN> to internal_control <at> debbugs.gnu.org. Full text available.

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


Received: (at 74865) by debbugs.gnu.org; 2 Jan 2025 15:46:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 02 10:46:39 2025
Received: from localhost ([127.0.0.1]:46210 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tTNPC-0007ta-Lj
	for submit <at> debbugs.gnu.org; Thu, 02 Jan 2025 10:46:39 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:4612)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
 id 1tTNP7-0007tE-MX
 for 74865 <at> debbugs.gnu.org; Thu, 02 Jan 2025 10:46:37 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0106D10004A;
 Thu,  2 Jan 2025 10:46:28 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1735832787;
 bh=LO1D7rHgPMomNTN476c2XMJZTlKnhj5GEaCWha8GQNk=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=MOljmDnC41DojVtm9A8sOTBp+ixjfBV6JtoIuwarCfUyXL4/U/cju5qXpZ5usN8ah
 56XQCdo3YXllzoUpV0Cb6d5elkIlw0JhBWCbO3x7j9cGc6Al6rTtzLQAX5jhykZMo4
 fptWu1IXFkJptXJcIsGvH7z70G93A4wD95jHkg0IODovB2sbWR12OqAD1DmsXoA4au
 qHhNt2WGWBdlQtbrbXY4rUKcjuEqw+Bzij7LY1e3HgevgCk+x1y0pAzuatOFYaYm0D
 3hTAJ4OEX/S+sTqmfVbIo1TLpx4l2qKFIQZbf969kJwiKuKnDgj8kvNLKOpvS/Xs6p
 xnrE39y/CMfGg==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3C067100035;
 Thu,  2 Jan 2025 10:46:27 -0500 (EST)
Received: from asado (104-195-200-87.cpe.teksavvy.com [104.195.200.87])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 03A6D1201CF;
 Thu,  2 Jan 2025 10:46:26 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
Subject: Re: bug#74865: [PATCH] Use `completion-table-with-metadata'
In-Reply-To: <87o71eifrs.fsf@HIDDEN> (Daniel Mendler's message of
 "Sat, 14 Dec 2024 13:57:11 +0100")
Message-ID: <jwvh66h5jmb.fsf-monnier+emacs@HIDDEN>
References: <87o71eifrs.fsf@HIDDEN>
Date: Thu, 02 Jan 2025 10:46:26 -0500
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.325 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 74865
Cc: Eli Zaretskii <eliz@HIDDEN>, Juri Linkov <juri@HIDDEN>,
 74865 <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: -3.3 (---)

I like this patch, thank you: `completion-extra-properties' should
ideally never be let-bound but should be set buffer-locally instead
(e.g. via `minibuffer-with-setup-hook`).

> +(defun proced--read-signal (count)
> +  "Read a SIGNAL via `completing-read' for COUNT processes."
> +  (completing-read
> +   (format-prompt "Send signal [%s]"
> +                  "TERM"
> +                  (if (= 1 count)
> +                      "1 process"
> +                    (format "%d processes" count)))
> +   (completion-table-with-metadata
> +    (completion-table-case-fold proced-signal-list)
> +    `((annotation-function
> +       . ,(lambda (s) (cdr (assoc s proced-signal-list))))))
> +   nil nil nil nil "TERM"))

[ FWIW, I'd pass `prompt` rather than `count` as argument.  ]


        Stefan





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

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


Received: (at submit) by debbugs.gnu.org; 28 Dec 2024 11:27:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 28 06:27:25 2024
Received: from localhost ([127.0.0.1]:49438 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tRUyb-0007rP-2z
	for submit <at> debbugs.gnu.org; Sat, 28 Dec 2024 06:27:25 -0500
Received: from lists.gnu.org ([209.51.188.17]:46286)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1tRUyZ-0007rG-Fm
 for submit <at> debbugs.gnu.org; Sat, 28 Dec 2024 06:27:24 -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 <eliz@HIDDEN>) id 1tRUyZ-00023d-6I
 for bug-gnu-emacs@HIDDEN; Sat, 28 Dec 2024 06:27:23 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1tRUyX-00052s-7P; Sat, 28 Dec 2024 06:27:21 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=1OKY38gnG1Ivj46xkKOZLXa8vl9vrGJXImA8TqdKjJ4=; b=RMe4hwd+Sogx
 pY59qlyJg7khcRFjDqaInlz/kfhsREzjI6WsaswFq6+pHtsbYBmO8GXzq/uLlQptPsXtupaDoPcUr
 YCxjGhh9Uj9Waz/KaeOGAYuATmVLuq8aUoRoXvqA7K6fm5irV8DZ91WZGCpqT1jT5YDO4akCyTY7v
 UBbB+rOPIG3gauVkxSbKYbFizdZz2LBg01yB7lqumtV6jCH+aiP1wxLmgOUwhITAKGkOyBK+Quhyu
 GVROUyxgro/3PGhoZru6qI2zg/oN/locXwYU1vNP/Wwupw3phX7FmnIh2YPE79sgr4KXdY+zSSYzq
 1JEW3yzZtHeLtp0qt1ZOLQ==;
Date: Sat, 28 Dec 2024 13:27:15 +0200
Message-Id: <86ed1st5d8.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <87o71eifrs.fsf@HIDDEN> (message from Daniel Mendler
 on Sat, 14 Dec 2024 13:57:11 +0100)
Subject: Re: [PATCH] Use `completion-table-with-metadata'
References: <87o71eifrs.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN, juri@HIDDEN
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: -3.3 (---)

> From: Daniel Mendler <mail@HIDDEN>
> Cc: Eli Zaretskii <eliz@HIDDEN>, Juri Linkov <juri@HIDDEN>
> Date: Sat, 14 Dec 2024 13:57:11 +0100
> 
> This is a small follow-up of bug#74616.  There I have introduced the
> `completion-table-with-metadata' helper function, which we can now take
> advantage of at more places.  By using `completion-table-with-metadata'
> we avoid problems with completion sessions in recursive minibuffers.

I'd ask Stefan (CC'ed) to review this, since I don't feel I know
enough about this to have a useful opinion.




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

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


Received: (at 74865) by debbugs.gnu.org; 16 Dec 2024 19:26:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 16 14:26:56 2024
Received: from localhost ([127.0.0.1]:56272 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tNGk4-0004XO-Dy
	for submit <at> debbugs.gnu.org; Mon, 16 Dec 2024 14:26:56 -0500
Received: from server.qxqx.de ([49.12.34.165]:59009 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1tNGk1-0004Ws-6W
 for 74865 <at> debbugs.gnu.org; Mon, 16 Dec 2024 14:26:54 -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=YUPR3nHk1virp9THvu/14WDrpCBNnPadV0gQJy2F20Y=; b=R7i5TNpeD+7x8nb0AQYWOZUUNE
 oEuK91ULnwOgtssYc6UT3cNfmDj4PymoGSWh57fvLaNud6Cbb/DoLqB7iMZ+f05US47yLmp75SxSZ
 NZt6MEOJvIVTRH6wz0CXbS1aBssXhs7ZTIutH8W3iGXzTbAO5HPNtYWYNHMehjHtuQJM=;
From: Daniel Mendler <mail@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#74865: [PATCH] Use `completion-table-with-metadata'
In-Reply-To: <87pllrcuga.fsf@HIDDEN> (Juri Linkov's message of "Mon, 
 16 Dec 2024 21:13:25 +0200")
References: <87o71eifrs.fsf@HIDDEN>
 <874j33ebhh.fsf@HIDDEN> <87seqnh47j.fsf@HIDDEN>
 <87pllrcuga.fsf@HIDDEN>
Date: Mon, 16 Dec 2024 20:26:45 +0100
Message-ID: <87ttb3pgy2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 74865
Cc: 74865 <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 (-)

Juri Linkov <juri@HIDDEN> writes:

>>> Also it could be used in `read-char-by-name' as well.
>>
>> Yes, there are certainly more use cases. I didn't use it for
>> `read-char-by-name' since this would change the caching behavior
>> slightly. The character names would be loaded a little bit earlier,
>> which would slow down the initialization of `read-char-by-name'.
>
> Maybe the caching behavior could be preserved by turning
> `completion-table-with-metadata' into a macro?

Let us please keep `completion-table-with-metadata' a function for
composeability and ease of reasoning. `completion-table-with-metadata'
follows the many already existing `completion-table-with-*' functions in
minibuffer.el.

In order to delay initialization of the completion candidates we can use
the following code:

(completion-table-with-metadata
 (lambda (string pred action)
   (complete-with-action action (ucs-names) string pred))
 metadata)

(completion-table-with-metadata
 (completion-table-dynamic (lambda (_) (ucs-names)))
 metadata)

>>> Maybe `completion-table-with-metadata' should be announced
>>> in the "Lisp Changes" section of etc/NEWS?
>>
>> Yes, please go ahead adding it to the NEWS. I will backport the function
>> also via Compat.
>
> Ok, now added to NEWS.

Thanks.

Daniel




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

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


Received: (at 74865) by debbugs.gnu.org; 16 Dec 2024 19:14:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 16 14:14:11 2024
Received: from localhost ([127.0.0.1]:56224 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tNGXj-0003lU-0b
	for submit <at> debbugs.gnu.org; Mon, 16 Dec 2024 14:14:11 -0500
Received: from relay7-d.mail.gandi.net ([217.70.183.200]:52785)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1tNGXg-0003ks-I1
 for 74865 <at> debbugs.gnu.org; Mon, 16 Dec 2024 14:14:09 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id BA7D520007;
 Mon, 16 Dec 2024 19:13:59 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
Subject: Re: bug#74865: [PATCH] Use `completion-table-with-metadata'
In-Reply-To: <87seqnh47j.fsf@HIDDEN> (Daniel Mendler's message of
 "Mon, 16 Dec 2024 19:29:04 +0100")
Organization: LINKOV.NET
References: <87o71eifrs.fsf@HIDDEN>
 <874j33ebhh.fsf@HIDDEN> <87seqnh47j.fsf@HIDDEN>
Date: Mon, 16 Dec 2024 21:13:25 +0200
Message-ID: <87pllrcuga.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 74865
Cc: 74865 <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 (-)

>> Also it could be used in `read-char-by-name' as well.
>
> Yes, there are certainly more use cases. I didn't use it for
> `read-char-by-name' since this would change the caching behavior
> slightly. The character names would be loaded a little bit earlier,
> which would slow down the initialization of `read-char-by-name'.

Maybe the caching behavior could be preserved by turning
`completion-table-with-metadata' into a macro?

>> Maybe `completion-table-with-metadata' should be announced
>> in the "Lisp Changes" section of etc/NEWS?
>
> Yes, please go ahead adding it to the NEWS. I will backport the function
> also via Compat.

Ok, now added to NEWS.




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

Message received at 74865-done <at> debbugs.gnu.org:


Received: (at 74865-done) by debbugs.gnu.org; 16 Dec 2024 19:04:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 16 14:04:21 2024
Received: from localhost ([127.0.0.1]:56194 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tNGOD-0003FE-HP
	for submit <at> debbugs.gnu.org; Mon, 16 Dec 2024 14:04:21 -0500
Received: from server.qxqx.de ([49.12.34.165]:35479 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1tNGO9-0003Ep-HJ
 for 74865-done <at> debbugs.gnu.org; Mon, 16 Dec 2024 14:04:20 -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:To:From:Sender:Reply-To:Cc:
 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=lHZ9a+XiV5epK7xMYM6DNSvfPlei7cSv9nKUpTAkcrw=; b=uHNhHgxkuwzKCkdP6GfJS4QcUb
 OfenIIVLbWOVoEUQmLmVR1KaLcHLD9HJ2BwywVQb2eVs57GPgqcL1xJLM3nd3PhOXSSqW7vuBvB6E
 99Myi26nYB9qXLQ8f3HEIKvyFst7Nch6AhwylNU+0Wzjea1jW6ZJWWndQjN0Sluc+yEM=;
From: Daniel Mendler <mail@HIDDEN>
To: 74865-done <at> debbugs.gnu.org
Subject: Re: bug#74865: [PATCH] Use `completion-table-with-metadata'
In-Reply-To: <87o71eifrs.fsf@HIDDEN> (Daniel Mendler's message of
 "Sat, 14 Dec 2024 13:57:11 +0100")
References: <87o71eifrs.fsf@HIDDEN>
Date: Mon, 16 Dec 2024 20:04:09 +0100
Message-ID: <87bjxbqwk6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 74865-done
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 (-)

Closing.




Notification sent to Daniel Mendler <mail@HIDDEN>:
bug acknowledged by developer. Full text available.
Reply sent to Daniel Mendler <mail@HIDDEN>:
You have taken responsibility. Full text available.

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


Received: (at 74865) by debbugs.gnu.org; 16 Dec 2024 18:31:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 16 13:31:26 2024
Received: from localhost ([127.0.0.1]:56140 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tNFsM-0001Xn-EI
	for submit <at> debbugs.gnu.org; Mon, 16 Dec 2024 13:31:26 -0500
Received: from server.qxqx.de ([49.12.34.165]:49257 helo=mail.qxqx.de)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1tNFsI-0001XO-JI
 for 74865 <at> debbugs.gnu.org; Mon, 16 Dec 2024 13:31:24 -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=MuLNqyVqHLsKJHPa/wwSMeumfz6XabL55FVmjWps6hk=; b=EURAGYSH/bZJFUxlwGOFzKKyz/
 ez8AXJej+rmt4dixikqlUpH/ZD3D7NPbvjqRX/IrPL2mjlCViqD29U/0KM9Z/QuoPA+fZ/DjF2Wyy
 ze3PvmOQ6GX57ATaVfPNxdXShuCa8nnydEtLCramjUCA1UB1GKhiwgzuKpYux1Uz1yIA=;
From: Daniel Mendler <mail@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#74865: [PATCH] Use `completion-table-with-metadata'
In-Reply-To: <874j33ebhh.fsf@HIDDEN> (Juri Linkov's message of "Mon, 
 16 Dec 2024 20:20:10 +0200")
References: <87o71eifrs.fsf@HIDDEN> <874j33ebhh.fsf@HIDDEN>
Date: Mon, 16 Dec 2024 19:29:04 +0100
Message-ID: <87seqnh47j.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 74865
Cc: 74865 <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 (-)

Juri Linkov <juri@HIDDEN> writes:

>> This is a small follow-up of bug#74616.  There I have introduced the
>> `completion-table-with-metadata' helper function, which we can now take
>> advantage of at more places.  By using `completion-table-with-metadata'
>> we avoid problems with completion sessions in recursive minibuffers.
>
> Thanks for the patch, now pushed.

Thanks!

> `completion-table-with-metadata' is a very useful function.
> I already used it for the new command 'comint-complete-input-ring'
> in bug#74694.
>
> Also it could be used in `read-char-by-name' as well.

Yes, there are certainly more use cases. I didn't use it for
`read-char-by-name' since this would change the caching behavior
slightly. The character names would be loaded a little bit earlier,
which would slow down the initialization of `read-char-by-name'.

My patch only changed the call sites which are exactly equivalent with
and without the patch.

> Maybe `completion-table-with-metadata' should be announced
> in the "Lisp Changes" section of etc/NEWS?

Yes, please go ahead adding it to the NEWS. I will backport the function
also via Compat.

Daniel




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

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


Received: (at 74865) by debbugs.gnu.org; 16 Dec 2024 18:22:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 16 13:22:08 2024
Received: from localhost ([127.0.0.1]:56126 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tNFjM-000129-1c
	for submit <at> debbugs.gnu.org; Mon, 16 Dec 2024 13:22:08 -0500
Received: from relay6-d.mail.gandi.net ([217.70.183.198]:48245)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1tNFjB-00010T-K2
 for 74865 <at> debbugs.gnu.org; Mon, 16 Dec 2024 13:21:58 -0500
Received: by mail.gandi.net (Postfix) with ESMTPSA id 10B6FC0002;
 Mon, 16 Dec 2024 18:21:49 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Daniel Mendler <mail@HIDDEN>
Subject: bug#74865: [PATCH] Use `completion-table-with-metadata'
In-Reply-To: <87o71eifrs.fsf@HIDDEN> (Daniel Mendler's message of
 "Sat, 14 Dec 2024 13:57:11 +0100")
Organization: LINKOV.NET
References: <87o71eifrs.fsf@HIDDEN>
Date: Mon, 16 Dec 2024 20:20:10 +0200
Message-ID: <874j33ebhh.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 74865
Cc: 74865 <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 (-)

> This is a small follow-up of bug#74616.  There I have introduced the
> `completion-table-with-metadata' helper function, which we can now take
> advantage of at more places.  By using `completion-table-with-metadata'
> we avoid problems with completion sessions in recursive minibuffers.

Thanks for the patch, now pushed.

`completion-table-with-metadata' is a very useful function.
I already used it for the new command 'comint-complete-input-ring'
in bug#74694.

Also it could be used in `read-char-by-name' as well.

Maybe `completion-table-with-metadata' should be announced
in the "Lisp Changes" section of etc/NEWS?




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

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


Received: (at submit) by debbugs.gnu.org; 14 Dec 2024 12:57:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 14 07:57:30 2024
Received: from localhost ([127.0.0.1]:45864 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tMRi5-00084z-6l
	for submit <at> debbugs.gnu.org; Sat, 14 Dec 2024 07:57:30 -0500
Received: from lists.gnu.org ([209.51.188.17]:46430)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1tMRhz-00084h-Ry
 for submit <at> debbugs.gnu.org; Sat, 14 Dec 2024 07:57:28 -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 <mail@HIDDEN>)
 id 1tMRhy-0002Kc-1g
 for bug-gnu-emacs@HIDDEN; Sat, 14 Dec 2024 07:57:22 -0500
Received: from server.qxqx.de ([2a01:4f8:c012:9177::1] helo=mail.qxqx.de)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mail@HIDDEN>)
 id 1tMRht-0004qD-BI; Sat, 14 Dec 2024 07:57:21 -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:
 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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=5vhVSgvjt06Qchm4IML71Kqi+YS/swBCbfKGbV9hVCw=; b=Td37YvhN7pN2r080BEs5x3h6kr
 sP7muXev3Gi/zZR8vKARCVey4llPYvsO2JIeRe7VVC0xJZTkmivnSdTk4O47jgI8NHR4ggjU078v5
 scBMxcvKl3PvarHsE5oIrep0JfK+wlleggTjOFwPw3z9E7nRzCh5o2j2XNRFuM1HOY74=;
From: Daniel Mendler <mail@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Use `completion-table-with-metadata'
Date: Sat, 14 Dec 2024 13:57:11 +0100
Message-ID: <87o71eifrs.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2a01:4f8:c012:9177::1;
 envelope-from=mail@HIDDEN; helo=mail.qxqx.de
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
Cc: Eli Zaretskii <eliz@HIDDEN>, Juri Linkov <juri@HIDDEN>
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: -2.4 (--)

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

Tags: patch

This is a small follow-up of bug#74616.  There I have introduced the
`completion-table-with-metadata' helper function, which we can now take
advantage of at more places.  By using `completion-table-with-metadata'
we avoid problems with completion sessions in recursive minibuffers.

Daniel


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-Use-completion-table-with-metadata.patch

From f9dca5a2a7d27a09c33af662a58a152cb371f65a Mon Sep 17 00:00:00 2001
From: Daniel Mendler <mail@HIDDEN>
Date: Mon, 9 Dec 2024 22:28:08 +0100
Subject: [PATCH] Use `completion-table-with-metadata'

Prefer `completion-table-with-metadata' over explicit completion
table lambdas for clarity.  Furthermore prefer it over
`completion-extra-properties' to avoid problems with recursive
minibuffers and recursive completion sessions, since the
completion metadata applies only to the outer completion session.

* lisp/bookmark.el (bookmark-completing-read):
* lisp/faces.el (read-face-name):
* lisp/international/emoji.el (emoji--read-emoji):
* lisp/net/dictionary.el (dictionary-completing-read-dictionary):
* lisp/net/rcirc.el (rcirc-completion-at-point):
* lisp/net/eww.el (eww-read-alternate-url):
* lisp/simple.el (read-from-kill-ring): Use it.
* lisp/calendar/calendar.el (calendar-read-date): Use
`completion-table-with-metadata' and `completion-table-case-fold'.
* lisp/proced.el (proced--read-signal): New function.
(proced-send-signal): Use it.
---
 lisp/bookmark.el            |  7 ++----
 lisp/calendar/calendar.el   | 14 +++++------
 lisp/faces.el               | 24 +++++++++----------
 lisp/international/emoji.el | 35 +++++++++++++--------------
 lisp/net/dictionary.el      | 20 +++++++++-------
 lisp/net/eww.el             | 47 ++++++++++++++++++++-----------------
 lisp/net/rcirc.el           |  6 ++---
 lisp/proced.el              | 47 +++++++++++++++++--------------------
 lisp/simple.el              |  8 +++----
 9 files changed, 99 insertions(+), 109 deletions(-)

diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index d43f9f740ca..e87b43b3c78 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -587,11 +587,8 @@ bookmark-completing-read
     (let* ((completion-ignore-case bookmark-completion-ignore-case)
            (default (unless (equal "" default) default)))
       (completing-read (format-prompt prompt default)
-                       (lambda (string pred action)
-                         (if (eq action 'metadata)
-                             '(metadata (category . bookmark))
-                             (complete-with-action
-                              action bookmark-alist string pred)))
+                       (completion-table-with-metadata
+                        bookmark-alist '((category . bookmark)))
                        nil 0 nil 'bookmark-history default))))
 
 
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 345687d1775..f901e1f1506 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -2335,14 +2335,14 @@ calendar-read-date
                                    defyear))
          (month-array calendar-month-name-array)
          (defmon (aref month-array (1- (calendar-extract-month default-date))))
-         (completion-ignore-case t)
          (month (cdr (assoc-string
-                      (let ((completion-extra-properties
-                             '(:category calendar-month)))
-                        (completing-read
-                         (format-prompt "Month name" defmon)
-                         (append month-array nil)
-                         nil t nil nil defmon))
+                      (completing-read
+                       (format-prompt "Month name" defmon)
+                       (completion-table-with-metadata
+                        (completion-table-case-fold
+                         (append month-array nil))
+                        `((category . calendar-month)))
+                       nil t nil nil defmon)
                       (calendar-make-alist month-array 1) t)))
          (defday (calendar-extract-day default-date))
          (last (calendar-last-day-of-month month year)))
diff --git a/lisp/faces.el b/lisp/faces.el
index f8ec0f1a187..05df685c679 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1147,17 +1147,6 @@ read-face-name
     (let ((prompt (if default
                       (format-prompt prompt default)
                     (format "%s: " prompt)))
-          (completion-extra-properties
-           `(:affixation-function
-             ,(lambda (faces)
-                (mapcar
-                 (lambda (face)
-                   (list face
-                         (concat (propertize read-face-name-sample-text
-                                             'face face)
-                                 "\t")
-                         ""))
-                 faces))))
           aliasfaces nonaliasfaces faces)
       ;; Build up the completion tables.
       (mapatoms (lambda (s)
@@ -1180,7 +1169,18 @@ read-face-name
             (nreverse faces))
         (let ((face (completing-read
                      prompt
-                     (completion-table-in-turn nonaliasfaces aliasfaces)
+                     (completion-table-with-metadata
+                      (completion-table-in-turn nonaliasfaces aliasfaces)
+                      `((affixation-function
+                        . ,(lambda (faces)
+                             (mapcar
+                              (lambda (face)
+                                (list face
+                                      (concat (propertize read-face-name-sample-text
+                                                          'face face)
+                                              "\t")
+                                      ""))
+                              faces)))))
                      nil t nil 'face-name-history defaults)))
           (when (facep face) (if (stringp face)
                                  (intern face)
diff --git a/lisp/international/emoji.el b/lisp/international/emoji.el
index 7ede6ac8058..337a2914084 100644
--- a/lisp/international/emoji.el
+++ b/lisp/international/emoji.el
@@ -663,25 +663,22 @@ emoji--read-emoji
          (name
           (completing-read
            "Insert emoji: "
-           (lambda (string pred action)
-	     (if (eq action 'metadata)
-		 (list 'metadata
-		       (cons
-                        'affixation-function
-                        ;; Add the glyphs to the start of the displayed
-                        ;; strings when TAB-ing.
-                        (lambda (strings)
-                          (mapcar
-                           (lambda (name)
-                             (if emoji-alternate-names
-                                 (list name "" "")
-                               (list name
-                                     (concat
-                                      (or (gethash name emoji--all-bases) " ")
-                                      "\t")
-                                     "")))
-                           strings))))
-	       (complete-with-action action table string pred)))
+           (completion-table-with-metadata
+            table
+            `((affixation-function
+               ;; Add the glyphs to the start of the displayed
+               ;; strings when TAB-ing.
+               . ,(lambda (strings)
+                    (mapcar
+                     (lambda (name)
+                       (if emoji-alternate-names
+                           (list name "" "")
+                         (list name
+                               (concat
+                                (or (gethash name emoji--all-bases) " ")
+                                "\t")
+                               "")))
+                     strings)))))
            nil t)))
     (if (cl-plusp (length name))
         (let ((glyph (if emoji-alternate-names
diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el
index 42fb8c57b40..8c7d87f56a5 100644
--- a/lisp/net/dictionary.el
+++ b/lisp/net/dictionary.el
@@ -1609,15 +1609,17 @@ dictionary-dictionaries
 (defun dictionary-completing-read-dictionary ()
   "Prompt for a dictionary the server supports."
   (let* ((dicts (dictionary-dictionaries))
-         (len (apply #'max (mapcar #'length (mapcar #'car dicts))))
-         (completion-extra-properties
-          (list :annotation-function
-                (lambda (key)
-                  (concat (make-string (1+ (- len (length key))) ?\s)
-                          (alist-get key dicts nil nil #'string=))))))
-    (completing-read (format-prompt "Select dictionary"
-                                    dictionary-default-dictionary)
-                     dicts nil t nil nil dictionary-default-dictionary)))
+         (len (apply #'max (mapcar #'length (mapcar #'car dicts)))))
+    (completing-read
+     (format-prompt "Select dictionary"
+                    dictionary-default-dictionary)
+     (completion-table-with-metadata
+      dicts
+      `((annotation-function
+         . ,(lambda (key)
+              (concat (make-string (1+ (- len (length key))) ?\s)
+                      (alist-get key dicts nil nil #'string=))))))
+     nil t nil nil dictionary-default-dictionary)))
 
 (define-button-type 'help-word
   :supertype 'help-xref
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 4609755a902..9b4bbca2e3e 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -2926,31 +2926,34 @@ eww-read-alternate-url
                             (mapcar #'caddr alternates))))
           (sep-width (string-pixel-width " ")))
       (if (cdr alternates)
-          (let ((completion-extra-properties
-                 (list :annotation-function
-                       (lambda (feed)
-                         (let* ((attrs (alist-get feed
-                                                  alternates
-                                                  nil
-                                                  nil
-                                                  #'string=))
-                                (type (car attrs))
-                                (title (cadr attrs)))
+            (completing-read
+             "Alternate URL: "
+             (completion-table-with-metadata
+              alternates
+              `((annotation-function
+                 . ,(lambda (feed)
+                      (let* ((attrs (alist-get feed
+                                               alternates
+                                               nil
+                                               nil
+                                               #'string=))
+                             (type (car attrs))
+                             (title (cadr attrs)))
+                        (concat
+                         (propertize " " 'display
+                                     `(space :align-to
+                                             (,(+ sep-width
+                                                  url-max-width))))
+                         title
+                         (when type
                            (concat
                             (propertize " " 'display
                                         `(space :align-to
-                                                (,(+ sep-width
-                                                     url-max-width))))
-                            title
-                            (when type
-                              (concat
-                               (propertize " " 'display
-                                           `(space :align-to
-                                                   (,(+ (* 2 sep-width)
-                                                        url-max-width
-                                                        title-max-width))))
-                               "[" type "]"))))))))
-            (completing-read "Alternate URL: " alternates nil t))
+                                                (,(+ (* 2 sep-width)
+                                                     url-max-width
+                                                     title-max-width))))
+                            "[" type "]"))))))))
+             nil t)
         (caar alternates)))))
 
 (defun eww-copy-alternate-url ()
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index c41e2ec153f..cced386e2d0 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -1323,10 +1323,8 @@ rcirc-completion-at-point
                         (rcirc-channel-nicks (rcirc-buffer-process)
                                              rcirc-target))))))
          (list beg (point)
-               (lambda (str pred action)
-                 (if (eq action 'metadata)
-                     '(metadata (cycle-sort-function . identity))
-                   (complete-with-action action table str pred)))))))
+               (completion-table-with-metadata
+                table '((cycle-sort-function . identity)))))))
 
 (defun rcirc-set-decode-coding-system (coding-system)
   "Set the decode CODING-SYSTEM used in this channel."
diff --git a/lisp/proced.el b/lisp/proced.el
index da9212f6802..21d1d7c9da4 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -2110,6 +2110,20 @@ proced-with-processes-buffer
                            (window-height . fit-window-to-buffer)))
          ,@body))))
 
+(defun proced--read-signal (count)
+  "Read a SIGNAL via `completing-read' for COUNT processes."
+  (completing-read
+   (format-prompt "Send signal [%s]"
+                  "TERM"
+                  (if (= 1 count)
+                      "1 process"
+                    (format "%d processes" count)))
+   (completion-table-with-metadata
+    (completion-table-case-fold proced-signal-list)
+    `((annotation-function
+       . ,(lambda (s) (cdr (assoc s proced-signal-list))))))
+   nil nil nil nil "TERM"))
+
 (defun proced-send-signal (&optional signal process-alist)
   "Send a SIGNAL to processes in PROCESS-ALIST.
 PROCESS-ALIST is an alist as returned by `proced-marked-processes'.
@@ -2124,20 +2138,10 @@ proced-send-signal
 and SIGNAL is queried interactively.  This noninteractive usage is still
 supported but discouraged.  It will be removed in a future version of Emacs."
   (interactive
-   (let* ((process-alist (proced-marked-processes))
-          (pnum (if (= 1 (length process-alist))
-                    "1 process"
-                  (format "%d processes" (length process-alist))))
-          (completion-ignore-case t)
-          (completion-extra-properties
-           `(:annotation-function
-             ,(lambda (s) (cdr (assoc s proced-signal-list))))))
-     (proced-with-processes-buffer process-alist
-       (list (completing-read (format-prompt "Send signal [%s]"
-                                             "TERM" pnum)
-                              proced-signal-list
-                              nil nil nil nil "TERM")
-             process-alist)))
+   (let ((process-alist (proced-marked-processes)))
+     (proced-with-processes-buffer
+         process-alist
+       (list (proced--read-signal (length process-alist)) process-alist)))
    proced-mode)
 
   (unless (and signal process-alist)
@@ -2151,18 +2155,9 @@ proced-send-signal
        (sit-for 2))
     (setq process-alist (proced-marked-processes))
     (unless signal
-      (let ((pnum (if (= 1 (length process-alist))
-                      "1 process"
-                    (format "%d processes" (length process-alist))))
-            (completion-ignore-case t)
-            (completion-extra-properties
-             `(:annotation-function
-               ,(lambda (s) (cdr (assoc s proced-signal-list))))))
-        (proced-with-processes-buffer process-alist
-          (setq signal (completing-read (format-prompt "Send signal [%s]"
-                                                       "TERM" pnum)
-                                        proced-signal-list
-                                        nil nil nil nil "TERM"))))))
+      (proced-with-processes-buffer
+          process-alist
+        (setq signal (proced--read-signal (length process-alist))))))
 
   (let (failures)
     ;; Why not always use `signal-process'?  See
diff --git a/lisp/simple.el b/lisp/simple.el
index f2ee4a5df67..e3e6ab6b564 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -6511,11 +6511,9 @@ read-from-kill-ring
              map)))
       (completing-read
        prompt
-       (lambda (string pred action)
-         (if (eq action 'metadata)
-             ;; Keep sorted by recency
-             '(metadata (display-sort-function . identity))
-           (complete-with-action action completions string pred)))
+       ;; Keep sorted by recency
+       (completion-table-with-metadata
+        completions '((display-sort-function . identity)))
        nil nil nil
        (if history-pos
            (cons 'read-from-kill-ring-history
-- 
2.45.2


--=-=-=--




Acknowledgement sent to Daniel Mendler <mail@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#74865; 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: Mon, 3 Feb 2025 18:45:01 UTC

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