diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-12-27 23:37:55 -0200 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2014-12-28 00:01:02 -0200 |
commit | 8c2b378b439d24ec7d3f4417c602a1b22e693709 (patch) | |
tree | 52af9bab2d2d0e595f2d2517366467b9ae7e3213 | |
parent | c37022ffbc52b900d81eee05f3c2c3d5fe6fee01 (diff) |
Implement sx--multiple-read for reading multiple strings
-rw-r--r-- | sx.el | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -189,6 +189,25 @@ All ARGS are passed to `completing-read' or `ido-completing-read'." (apply (if ido-mode #'ido-completing-read #'completing-read) args)) +(defun sx--multiple-read (prompt hist-var) + "Interactively query gthe user for a list of strings. +Call `read-string' multiple times, until the input is empty. + +PROMPT is a string displayed to the user. and should not +end with a space nor a colon. +HIST-VAR is a quoted symbol, indicating a list in which to store +input history." + (let (list input) + (while (not (string= + "" + (setq input (read-string + (concat prompt " [" + (mapconcat #'identity list ",") + "]: ") + "" hist-var)))) + (push input list)) + list)) + (defmacro sx-sorted-insert-skip-first (newelt list &optional predicate) "Inserted NEWELT into LIST sorted by PREDICATE. This is designed for the (site id id ...) lists. So the first car |