Function: cond-let--when-let
cond-let--when-let is a macro defined in cond-let.el.
Signature
(cond-let--when-let VARLIST BODY...)
Documentation
Bind variables according to VARLIST and conditionally evaluate BODY.
Each element of VARLIST is a list (SYMBOL VALUEFORM), which binds SYMBOL
to the value of VALUEFORM. Evaluate all VALUEFORMs before binding their
respective SYMBOLs (as for let).
If all VALUEFORMs yield non-nil, evaluate BODY forms sequentially, with VARLIST's bindings in effect, and return the value of the last form.
If any VALUEFORM yields nil, evaluate neither the remaining VALUEFORMs nor the BODY forms, and instead return nil.
BODY must be one or more expressions. If VARLIST is empty, do nothing and return nil.
Source Code
;; Defined in ~/.emacs.d/elpa/cond-let-20260201.1500/cond-let.el
(defmacro cond-let--when-let (varlist bodyform &rest body)
"Bind variables according to VARLIST and conditionally evaluate BODY.
Each element of VARLIST is a list (SYMBOL VALUEFORM), which binds SYMBOL
to the value of VALUEFORM. Evaluate all VALUEFORMs before binding their
respective SYMBOLs (as for `let').
If all VALUEFORMs yield non-nil, evaluate BODY forms sequentially, with
VARLIST's bindings in effect, and return the value of the last form.
If any VALUEFORM yields nil, evaluate neither the remaining VALUEFORMs
nor the BODY forms, and instead return nil.
BODY must be one or more expressions. If VARLIST is empty, do nothing
and return nil.
\(fn VARLIST BODY...)"
(declare (indent 1) (debug cond-let--when-let*))
(pcase-let ((`(,anon ,set ,bind ,lastvar)
(cond-let--prepare-varforms varlist)))
(cond (anon
`(let ,anon
(when (and ,@set)
(let ,bind
,bodyform ,@body))))
(t
`(let ,bind
(when ,lastvar
,bodyform ,@body))))))