1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 10:31:37 -08:00

Add clarification to if-let* docstring

Also make its behaviour consistent with and-let* in that empty bindings
results in success, not failure.
* lisp/emacs-lisp/subr-x.el: Edit docstring, change else to then.
This commit is contained in:
Mark Oteiza 2017-09-13 13:25:41 -04:00
parent 6519df8f5a
commit bdb71dea4a

View file

@ -128,9 +128,10 @@ binding value is nil. If all are non-nil, the value of THEN is
returned, or the last form in ELSE is returned.
Each element of VARLIST is a list (SYMBOL VALUEFORM) which binds
SYMBOL to the value of VALUEFORM).
An element can additionally be of the form (VALUEFORM), which is
evaluated and checked for nil."
SYMBOL to the value of VALUEFORM). An element can additionally
be of the form (VALUEFORM), which is evaluated and checked for
nil; i.e. SYMBOL can be omitted if only the test result is of
interest."
(declare (indent 2)
(debug ((&rest [&or symbolp (symbolp form) (sexp)])
form body)))
@ -139,7 +140,7 @@ evaluated and checked for nil."
(if ,(caar (last varlist))
,then
,@else))
`(let* () ,@else)))
`(let* () ,then)))
(defmacro when-let* (varlist &rest body)
"Bind variables according to VARLIST and conditionally eval BODY.