; * lisp/subr.el (and-let*): Expand to 'and' not 'when'.

This commit is contained in:
Sean Whitton 2026-02-20 12:33:25 +00:00
parent 0903fe3ac0
commit f680b988c2

View file

@ -2874,11 +2874,11 @@ for forms evaluated for side-effect with returned values ignored."
;; 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)
(let (res (body* (macroexp-progn body)))
(if varlist
`(let* ,(setq varlist (internal--build-bindings varlist))
(when ,(setq res (caar (last varlist)))
,@(or body `(,res))))
,(progn (setq res (caar (last varlist)))
(if body* `(and ,res ,body*) res)))
`(let* () ,@(or body '(t))))))
(defmacro if-let (spec then &rest else)