GNU bug report logs - #76028
31; completing-read-multiple: Add prompt indicator

Previous Next

Package: emacs;

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

Date: Mon, 3 Feb 2025 09:28:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Daniel Mendler <mail <at> daniel-mendler.de>
To: 76028 <at> debbugs.gnu.org
Cc: Juri Linkov <juri <at> linkov.net>
Subject: bug#76028: 31; completing-read-multiple: Add prompt indicator
Date: Mon, 03 Feb 2025 10:27:30 +0100
The function `completing-read-multiple' (CRM) can be used to read
multiple candidates, separated by comma (see the variable
`crm-separator'). Besides that it acts similarly to `completing-read'.
To the user it is no obvious if CRM is used.

For years I have used an advice in my configuration which adds a CRM
indicator to the prompt. For example, the advice turns the
`describe-face' prompt from "Describe face: " into "[CRM ,] Describe
face: ", which tells the user that multiple face names are read,
separated by comma:

#+begin_src emacs-lisp
(defun crm-indicator (args)
  (defvar crm-separator)
  (cons (format "[%s %s] %s"
                (propertize "CRM" 'face 'error)
                (propertize
                 (replace-regexp-in-string
                  "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
                  crm-separator)
                 'face 'success)
                (car args))
        (cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
#+end_src

I propose to add such an indicator to CRM by default. Above I have
chosen the tag "CRM" for its shortness, but a more user friendly
solution might require a longer more descriptive name. Furthermore the
code above extracts the separator from the regular expression
`crm-separator', which is not robust for all separators.




This bug report was last modified 85 days ago.

Previous Next


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