Function: cond-let--prepare-varforms
cond-let--prepare-varforms is a byte-compiled function defined in
cond-let.el.
Signature
(cond-let--prepare-varforms VARLIST &optional IF-LET)
Documentation
Used by Cond-Let's when-let, and-let, while-let and if-let.
Return (ANON-VARLIST ANON-SETQ VARLIST LASTVAR), or if the length of VARLIST is 1 and IF-LET is nil, return (nil nil VARLIST LASTVAR).
Source Code
;; Defined in ~/.emacs.d/elpa/cond-let-20260201.1500/cond-let.el
(defun cond-let--prepare-varforms (varlist &optional if-let)
"Used by Cond-Let's `when-let', `and-let', `while-let' and `if-let'.
Return (ANON-VARLIST ANON-SETQ VARLIST LASTVAR), or if the length of
VARLIST is 1 and IF-LET is nil, return (nil nil VARLIST LASTVAR)."
(if (and (not if-let)
(length= varlist 1))
`(nil nil ,@(cond-let--prepare-varlist varlist))
(let ((triples
(mapcar (lambda (binding)
(unless (length= binding 2)
(signal 'error (cons "Invalid binding" binding)))
(pcase-let ((`(,var ,form) binding))
(when (string-prefix-p "_" (symbol-name var))
(setq var nil))
(list (and var (gensym "anon"))
var
form)))
varlist)))
(list (mapcan (pcase-lambda (`(,anon ,_ ,_))
(and anon (list anon)))
triples)
(mapcar (pcase-lambda (`(,anon ,_ ,form))
(if anon
`(setq ,anon ,form)
form))
triples)
(mapcan (pcase-lambda (`(,anon ,var ,_))
(and var `((,var ,anon))))
triples)
(cadr (car (last triples)))))))