From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Daniel Mendler <mail@daniel-mendler.de>
Cc: Eli Zaretskii <eliz@gnu.org>, Juri Linkov <juri@linkov.net>,
74865@debbugs.gnu.org
Subject: bug#74865: [PATCH] Use `completion-table-with-metadata'
Date: Thu, 02 Jan 2025 10:46:26 -0500 [thread overview]
Message-ID: <jwvh66h5jmb.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87o71eifrs.fsf@daniel-mendler.de> (Daniel Mendler's message of "Sat, 14 Dec 2024 13:57:11 +0100")
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
prev parent reply other threads:[~2025-01-02 15:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-14 12:57 bug#74865: [PATCH] Use `completion-table-with-metadata' Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-16 18:20 ` Juri Linkov
2024-12-16 18:29 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-16 19:13 ` Juri Linkov
2024-12-16 19:26 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-16 19:04 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-28 11:27 ` Eli Zaretskii
2025-01-02 15:46 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
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=jwvh66h5jmb.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=74865@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=juri@linkov.net \
--cc=mail@daniel-mendler.de \
--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).