Function: magit-bind-match-strings
magit-bind-match-strings is a macro defined in magit-base.el.
Signature
(magit-bind-match-strings VARLIST STRING &rest BODY)
Documentation
Bind variables to submatches according to VARLIST then evaluate BODY.
Bind the symbols in VARLIST to submatches of the current match data, starting with 1 and incrementing by 1 for each symbol. If the last match was against a string, then that has to be provided as STRING.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-base.el
;;; Text Utilities
(defmacro magit-bind-match-strings (varlist string &rest body)
"Bind variables to submatches according to VARLIST then evaluate BODY.
Bind the symbols in VARLIST to submatches of the current match data,
starting with 1 and incrementing by 1 for each symbol. If the last
match was against a string, then that has to be provided as STRING."
(declare (indent 2) (debug (listp form body)))
(let ((s (gensym "string"))
(i 0))
`(let* ((,s ,string)
,@(save-match-data
(seq-keep (lambda (sym)
(cl-incf i)
(and (not (eq (aref (symbol-name sym) 0) ?_))
`(,sym (match-str ,i ,s))))
varlist)))
,@body)))