Function: multi-prompt
multi-prompt is an autoloaded and byte-compiled function defined in
multi-prompt.el.
Signature
(multi-prompt SEPARATOR UNIQUE PROMPT TABLE &optional MP-PREDICATE REQUIRE-MATCH INITIAL HISTORY)
Documentation
Completing prompt for a list of strings.
The first argument SEPARATOR should be the string (of length 1) to
separate the elements in the list. The second argument UNIQUE should
be non-nil, if each element must be unique. The remaining elements
are the arguments to completing-read. See that.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/multi-prompt.el
;; FIXME: Modify all caller (including ones in reftex-auc.el) to use
;; more sophisticated crm.el. After that, we no longer need the
;; former half of this file.
;;;###autoload
(defun multi-prompt (separator
unique prompt table
&optional mp-predicate require-match initial history)
"Completing prompt for a list of strings.
The first argument SEPARATOR should be the string (of length 1) to
separate the elements in the list. The second argument UNIQUE should
be non-nil, if each element must be unique. The remaining elements
are the arguments to `completing-read'. See that."
(let ((old-map (if require-match
minibuffer-local-must-match-map
minibuffer-local-completion-map))
(new-map (make-sparse-keymap)))
(set-keymap-parent new-map old-map)
(define-key new-map separator (if require-match
#'multi-prompt-next-must-match
#'multi-prompt-next))
(define-key new-map "\C-?" #'multi-prompt-delete)
(let* ((minibuffer-local-completion-map new-map)
(minibuffer-local-must-match-map new-map)
(multi-prompt-found nil)
(filter (cond (unique
(lambda (x)
(and (not (member (car x) multi-prompt-found))
(or (null mp-predicate)
(funcall mp-predicate x)))))
(mp-predicate)))
(answer (catch 'multi-prompt-exit
(while t
(let ((extra (catch 'multi-prompt-next
(throw 'multi-prompt-exit
(completing-read prompt
table
filter
require-match
initial
history)))))
(cond ((eq extra 'back)
(when multi-prompt-found
(setq prompt (substring
prompt 0
(- 0 (length separator)
(length
(car multi-prompt-found))))
initial (car multi-prompt-found))
(setq multi-prompt-found
(cdr multi-prompt-found))))
(t
(setq prompt (concat prompt extra separator)
initial nil)
(setq multi-prompt-found
(cons extra multi-prompt-found)))))))))
(if (string= answer "")
multi-prompt-found
(nreverse (cons answer multi-prompt-found))))))