Function: completing-read-multiple

completing-read-multiple is an autoloaded and byte-compiled function defined in crm.el.gz.

Signature

(completing-read-multiple PROMPT TABLE &optional PREDICATE REQUIRE-MATCH INITIAL-INPUT HIST DEF INHERIT-INPUT-METHOD)

Documentation

Read multiple strings in the minibuffer, with completion.

The arguments are the same as those of completing-read. Input multiple strings by separating each one with a string that matches the regexp crm-separator. For example, if the separator regexp is ",", entering "alice,bob,eve" specifies the strings
"alice", "bob", and "eve".

We refer to contiguous strings of non-separator-characters as
"elements". In this example there are three elements.

Completion is available on a per-element basis. For example, if the contents of the minibuffer are "alice,bob,eve" and point is between
"l" and "i", pressing TAB (minibuffer-complete) operates on the element "alice".

This function returns a list of the strings that were read, with empty strings removed.

Probably introduced at or before Emacs version 24.4.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/crm.el.gz
;; superemulates behavior of completing_read in src/minibuf.c
;; Use \\<crm-local-completion-map> so that help-enable-autoload can
;; do its thing.  Any keymap that is defined will do.
;;;###autoload
(defun completing-read-multiple
  (prompt table &optional predicate require-match initial-input
	  hist def inherit-input-method)
  "Read multiple strings in the minibuffer, with completion.
The arguments are the same as those of `completing-read'.
\\<crm-local-completion-map>
Input multiple strings by separating each one with a string that
matches the regexp `crm-separator'.  For example, if the separator
regexp is \",\", entering \"alice,bob,eve\" specifies the strings
\"alice\", \"bob\", and \"eve\".

We refer to contiguous strings of non-separator-characters as
\"elements\".  In this example there are three elements.

Completion is available on a per-element basis.  For example, if the
contents of the minibuffer are \"alice,bob,eve\" and point is between
\"l\" and \"i\", pressing \\[minibuffer-complete] operates on the element \"alice\".

This function returns a list of the strings that were read,
with empty strings removed."
  (unwind-protect
      (progn
	(add-hook 'choose-completion-string-functions
		  'crm--choose-completion-string)
	(let* ((minibuffer-completion-table #'crm--collection-fn)
	       (minibuffer-completion-predicate predicate)
	       ;; see completing_read in src/minibuf.c
	       (minibuffer-completion-confirm
		(unless (eq require-match t) require-match))
	       (crm-completion-table table)
	       (map (if require-match
			crm-local-must-match-map
		      crm-local-completion-map))
	       ;; If the user enters empty input, `read-from-minibuffer'
	       ;; returns the empty string, not DEF.
	       (input (read-from-minibuffer
		       prompt initial-input map
		       nil hist def inherit-input-method)))
	  (when (and def (string-equal input ""))
	    (setq input (if (consp def) (car def) def)))
          ;; Remove empty strings in the list of read strings.
	  (split-string input crm-separator t)))
    (remove-hook 'choose-completion-string-functions
		 'crm--choose-completion-string)))