I am trying to accept user input for a command-line utility in emacs. I've got a handful of words that I can use in this command-line (something like the possible target list of a make invocation), and I want to be able to auto-complete words that I know about, allow user to input more than one entry in my dictionary, and also allow the user to write things not in my dictionary. Some library that allows word completion in minibuffer using a custom dictionary would be just the thing.
I do not require a full solution, but a few pointers on where to start looking would be much appreciated. Also, I'd rather avoid using intrusive libraries such as icicles
or ido
if at all possible - I don't want the users of this package to be limited in how they configure the rest of their setup.
My best solution so far is to use completing-read
multiple times for each target until the user enters the empty string.
event_jr's answer below did the trick. The final code I've used looks like:
(require 'crm)
(let ((crm-separator " ")
(crm-local-completion-map (copy-keymap crm-local-completion-map)))
(define-key crm-local-completion-map " " 'self-insert-command)
(completing-read-multiple "prompt: " '("foo" "foobar" "baz"))))
How about this:
(completing-read-multiple ": " '("foo" "foo2" "foobar"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With