Subject: Re: bug#74865: [PATCH] Use `completion-table-with-metadata'

From: Stefan Monnier <[email-masked]>
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