Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
(defun ido-completing-read-multiple (prompt choices &optional predicate require-match initial-input hist def sentinel)
"Read multiple items with ido-completing-read. Reading stops
when the user enters SENTINEL. By default, SENTINEL is
\"*done*\". SENTINEL is disambiguated with clashing completions
by appending _ to SENTINEL until it becomes unique. So if there
are multiple values that look like SENTINEL, the one with the
most _ at the end is the actual sentinel value. See
documentation for `ido-completing-read' for details on the
other parameters."
((sentinel (if sentinel sentinel "*done*"))
(done-reading nil)
(res ()))
;; uniquify the SENTINEL value
(while (find sentinel choices)
(setq sentinel (concat sentinel "_")))
(setq choices (cons sentinel choices))
;; read some choices
(while (not done-reading)
(setq this-choice (ido-completing-read prompt choices predicate require-match initial-input hist def))
(if (equal this-choice sentinel)
(setq done-reading t)
(setq res (cons this-choice res))))
;; return the result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.