emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Better alternative to completing-read-multiple


From: Ilya Chernyshov
Subject: Better alternative to completing-read-multiple
Date: Sat, 20 Apr 2024 04:18:59 +0700

Hello

In completing-read-multiple, the resulting list of chosen strings is made
by splitting the input string with crm-separator regular expression variable.

This approach is not suitable for a list of candidates where a candidate
string might contain a character that is currently treated as a
separator.  Imagine a situation where you read a list of Org headings
from user.  In an Org heading you can have any character including the
default separator ",".  Changing the value of crm-separator locally is
not a solution here.

A much better solution could be a completion command where a chosen
candidate is appended to a list (displayed in the prompt) when a user
presses RET and then returned when a user presses something like
C-RET.  Already chosen candidates could be erased via C-<backspace>

This functionality definitely could be helpful at least in org, org-ql packages
(for completion over org headings).

I am not an Elisp expert, but here's some drafts.  If you are interested,
please comment.

Test the function:

(ic-completing-read-multiple "Prompt: " '("first" "second" "third"))

Attachment: ic-read-multiple.el
Description: application/emacs-lisp


reply via email to

[Prev in Thread] Current Thread [Next in Thread]