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

Previous Next

Package: emacs;

Reported by: Daniel Mendler <mail <at> daniel-mendler.de>

Date: Sat, 14 Dec 2024 12:58:02 UTC

Severity: normal

Tags: patch

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Daniel Mendler <mail <at> daniel-mendler.de>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Juri Linkov <juri <at> linkov.net>, 74865 <at> debbugs.gnu.org
Subject: bug#74865: [PATCH] Use `completion-table-with-metadata'
Date: Thu, 02 Jan 2025 10:46:26 -0500
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





This bug report was last modified 163 days ago.

Previous Next


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