Function: magit-completing-read-multiple
magit-completing-read-multiple is a byte-compiled function defined in
magit-base.el.
Signature
(magit-completing-read-multiple PROMPT TABLE &optional PREDICATE REQUIRE-MATCH INITIAL-INPUT HIST DEF INHERIT-INPUT-METHOD NO-SPLIT)
Documentation
Read multiple strings in the minibuffer, with completion.
Like completing-read-multiple but don't mess with order of
TABLE and take an additional argument NO-SPLIT, which causes
the user input to be returned as a single unmodified string.
Also work around various incompatible features of various
third-party completion frameworks.
Aliases
magit-completing-read-multiple* (obsolete since Magit-Section 4.0.0)
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-base.el
(defun magit-completing-read-multiple
( prompt table &optional predicate require-match initial-input
hist def inherit-input-method
no-split)
"Read multiple strings in the minibuffer, with completion.
Like `completing-read-multiple' but don't mess with order of
TABLE and take an additional argument NO-SPLIT, which causes
the user input to be returned as a single unmodified string.
Also work around various incompatible features of various
third-party completion frameworks."
(cl-letf*
(;; To implement NO-SPLIT we have to manipulate the respective
;; `split-string' invocation. We cannot simply advice it to
;; return the input string because `SELECTRUM' would choke on
;; that string. Use a variable to pass along the raw user
;; input string. aa5f098ab
(input nil)
(split-string (symbol-function #'split-string))
((symbol-function #'split-string)
(lambda (string &optional separators omit-nulls trim)
(when (and no-split
(equal separators crm-separator)
(equal omit-nulls t))
(setq input string))
(funcall split-string string separators omit-nulls trim)))
;; Add the default to the table if absent, which is necessary
;; because we don't add it to the prompt for some frameworks.
(table (if (and def
(listp table)
(not (listp (car table)))
(not (member def table)))
(cons def table)
table))
;; Prevent `BUILT-IN' completion from messing up our existing
;; order of the completion candidates. aa5f098ab
(table (magit--completion-table table))
;; Prevent `IVY' from messing up our existing order. c7af78726
(ivy-sort-matches-functions-alist nil)
;; Prevent `HELM' from messing up our existing order. 6fcf994bd
(helm-completion-in-region-default-sort-fn nil)
;; Prevent `HELM' from automatically appending the separator,
;; which is counterproductive when NO-SPLIT is non-nil and/or
;; when reading commit ranges. 798aff564
(helm-crm-default-separator
(if no-split nil (bound-and-true-p helm-crm-default-separator)))
;; And now, the moment we have all been waiting for...
(values (completing-read-multiple
(magit--format-prompt prompt def)
table predicate
(if (eq require-match 'any) nil require-match)
initial-input hist def inherit-input-method)))
(when (and (eq require-match 'any)
(not values))
(user-error "Nothing selected"))
(if no-split input values)))