Function: and-let*
and-let* is a macro defined in subr.el.gz.
Signature
(and-let* VARLIST &rest BODY)
Documentation
Bind variables according to VARLIST and conditionally evaluate BODY.
Like when-let*, except if BODY is empty and all the bindings
are non-nil, then the result is the value of the last binding.
Some Lisp programmers follow the convention that and and and-let*
are for forms evaluated for return value, and when and when-let* are
for forms evaluated for side-effect with returned values ignored.
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defmacro and-let* (varlist &rest body)
"Bind variables according to VARLIST and conditionally evaluate BODY.
Like `when-let*', except if BODY is empty and all the bindings
are non-nil, then the result is the value of the last binding.
Some Lisp programmers follow the convention that `and' and `and-let*'
are for forms evaluated for return value, and `when' and `when-let*' are
for forms evaluated for side-effect with returned values ignored."
;; ^ Document this convention here because it explains why we have
;; both `when-let*' and `and-let*' (in addition to the additional
;; feature of `and-let*' when BODY is empty).
(declare (indent 1) (debug if-let*))
(let (res)
(if varlist
`(let* ,(setq varlist (internal--build-bindings varlist))
(when ,(setq res (caar (last varlist)))
,@(or body `(,res))))
`(let* () ,@(or body '(t))))))