Function: cond*
cond* is an autoloaded macro defined in cond-star.el.gz.
Signature
(cond* &rest CLAUSES)
Documentation
Extended form of traditional Lisp cond construct.
A cond* construct is a series of clauses, and a clause
normally has the form (CONDITION BODY...).
CONDITION can be a Lisp expression, as in cond.
Or it can be one of (bind* BINDINGS...), (match* PATTERN DATUM),
or (pcase* PATTERN DATUM),
(bind* BINDINGS...) means to bind BINDINGS (as if they were in let*)
for the body of the clause, and all subsequent clauses, since the bind*
clause is always a non-exit clause. As a condition, it counts as true
and runs the body of the clause if the first binding's value is non-nil.
(match* PATTERN DATUM) means to match DATUM against the pattern PATTERN
For its patterns, see match*.
The condition counts as true if PATTERN matches DATUM.
(bind-and* BINDINGS...) means to bind BINDINGS (as if they were in
if-let*) for only the the body of the clause. If any expression
evaluates to nil, the condition counts as false.
(pcase* PATTERN DATUM) means to match DATUM against the
pattern PATTERN, using the same pattern syntax as pcase.
The condition counts as true if PATTERN matches DATUM.
When a clause's condition is true, and it exits the cond*
or is the last clause, the value of the last expression
in its body becomes the return value of the cond* construct.
Non-exit clause:
If a clause has only one element, or if its first element is
t or a bind* clause, this clause never exits the cond* construct.
Instead, control always falls through to the next clause (if any).
All bindings made in CONDITION for the BODY of the non-exit clause
are passed along to the rest of the clauses in this cond* construct.
M-x match* (match*) for documentation of the patterns for use in match*.
Probably introduced at or before Emacs version 31.1.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/cond-star.el.gz
(require 'cl-lib) ; for cl-assert
;;;###autoload
(defmacro cond* (&rest clauses)
"Extended form of traditional Lisp `cond' construct.
A `cond*' construct is a series of clauses, and a clause
normally has the form (CONDITION BODY...).
CONDITION can be a Lisp expression, as in `cond'.
Or it can be one of `(bind* BINDINGS...)', `(match* PATTERN DATUM)',
or `(pcase* PATTERN DATUM)',
`(bind* BINDINGS...)' means to bind BINDINGS (as if they were in `let*')
for the body of the clause, and all subsequent clauses, since the `bind*'
clause is always a non-exit clause. As a condition, it counts as true
and runs the body of the clause if the first binding's value is non-nil.
`(match* PATTERN DATUM)' means to match DATUM against the pattern PATTERN
For its patterns, see `match*'.
The condition counts as true if PATTERN matches DATUM.
`(bind-and* BINDINGS...)' means to bind BINDINGS (as if they were in
`if-let*') for only the the body of the clause. If any expression
evaluates to nil, the condition counts as false.
`(pcase* PATTERN DATUM)' means to match DATUM against the
pattern PATTERN, using the same pattern syntax as `pcase'.
The condition counts as true if PATTERN matches DATUM.
When a clause's condition is true, and it exits the `cond*'
or is the last clause, the value of the last expression
in its body becomes the return value of the `cond*' construct.
Non-exit clause:
If a clause has only one element, or if its first element is
t or a `bind*' clause, this clause never exits the `cond*' construct.
Instead, control always falls through to the next clause (if any).
All bindings made in CONDITION for the BODY of the non-exit clause
are passed along to the rest of the clauses in this `cond*' construct.
\\[match*] for documentation of the patterns for use in `match*'."
;; FIXME: Want an Edebug declaration.
(cond*-convert clauses))