Function: magit-confirm
magit-confirm is a byte-compiled function defined in magit-base.el.
Signature
(magit-confirm ACTION &optional PROMPT PROMPT-N NOABORT (ITEMS nil SITEMS) PROMPT-SUFFIX)
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-base.el
(cl-defun magit-confirm ( action &optional prompt prompt-n noabort
(items nil sitems) prompt-suffix)
(declare (indent defun))
(when (and prompt (listp prompt))
(setq prompt
(apply #'format (car prompt)
(mapcar (##if (stringp %) (string-replace "%" "%%" %) %)
(cdr prompt)))))
(when (and prompt-n (listp prompt-n))
(setq prompt-n
(apply #'format (car prompt-n)
(mapcar (##if (stringp %) (string-replace "%" "%%" %) %)
(cdr prompt-n)))))
(setq prompt-n (format (concat (or prompt-n prompt) "? ") (length items)))
(setq prompt (format (concat (or prompt (magit-confirm-make-prompt action))
"? ")
(car items)))
(when prompt-suffix
(setq prompt (concat prompt prompt-suffix)))
(or (cond ((and (not (eq action t))
(or (eq magit-no-confirm t)
(memq action magit-no-confirm)
(magit--any (pcase-lambda (`(,key ,var . ,sub))
(and (memq key magit-no-confirm)
(memq action sub)
(or (not var)
(and (boundp var)
(symbol-value var)))))
magit--no-confirm-alist)))
(or (not sitems) items))
((not sitems)
(magit-y-or-n-p prompt action))
((length= items 1)
(and (magit-y-or-n-p prompt action) items))
((length> items 1)
(and (magit-y-or-n-p (concat (string-join items "\n")
"\n\n" prompt-n)
action)
items)))
(if noabort nil (user-error "Abort"))))