Function: while-let

while-let is a macro defined in compat-29.el.

Signature

(while-let SPEC &rest BODY)

Documentation

[Compatibility macro for while-let, defined in Emacs 29.1. See (compat) Emacs
29.1' for more details.]

Bind variables according to SPEC and conditionally evaluate BODY. Evaluate each binding in turn, stopping if a binding value is nil. If all bindings are non-nil, eval BODY and repeat.

The variable list SPEC is the same as in if-let*.

Source Code

;; Defined in ~/.emacs.d/elpa/compat-30.1.0.1/compat-29.el
(compat-defmacro while-let (spec &rest body) ;; <compat-tests:while-let>
  "Bind variables according to SPEC and conditionally evaluate BODY.
Evaluate each binding in turn, stopping if a binding value is nil.
If all bindings are non-nil, eval BODY and repeat.

The variable list SPEC is the same as in `if-let*'."
  (declare (indent 1) (debug if-let))
  (let ((done (gensym "done")))
    `(catch ',done
       (while t
         (if-let* ,spec
             (progn
               ,@body)
           (throw ',done nil))))))