diff options
author | Glenn Morris <rgm@gnu.org> | 2018-12-02 10:32:25 -0800 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2018-12-02 10:32:25 -0800 |
commit | e5634aae531ce932ecb8d84243d690c7ca89bec3 (patch) | |
tree | 9b65030fca17dcb52be481ed229ad4b321cb866e /lisp/emacs-lisp | |
parent | 5f6d7a4f9d5970e6cb1dfc3bd8cdfa4651cf0678 (diff) | |
parent | 745c9c02582443680167501b218cc59f1a2d3fb6 (diff) | |
download | emacs-e5634aae531ce932ecb8d84243d690c7ca89bec3.tar.gz emacs-e5634aae531ce932ecb8d84243d690c7ca89bec3.tar.bz2 emacs-e5634aae531ce932ecb8d84243d690c7ca89bec3.zip |
Merge from origin/emacs-26
745c9c0 (origin/emacs-26) Revert "Revert "Fix infloop in GC mark_kboa...
c418c85 Revert "Fix infloop in GC mark_kboards"
8fa0d96 * lisp/emacs-lisp/subr-x.el (if-let, when-let): Doc fix: acti...
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/subr-x.el | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 20eb0d5d05c..3d59af2505d 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -122,7 +122,7 @@ If ELT is of the form ((EXPR)), listify (EXPR) with a dummy symbol." bindings))) (defmacro if-let* (varlist then &rest else) - "Bind variables according to VARLIST and eval THEN or ELSE. + "Bind variables according to VARLIST and evaluate THEN or ELSE. This is like `if-let' but doesn't handle a VARLIST of the form \(SYMBOL SOMETHING) specially." (declare (indent 2) @@ -136,14 +136,14 @@ This is like `if-let' but doesn't handle a VARLIST of the form `(let* () ,then))) (defmacro when-let* (varlist &rest body) - "Bind variables according to VARLIST and conditionally eval BODY. + "Bind variables according to VARLIST and conditionally evaluate BODY. This is like `when-let' but doesn't handle a VARLIST of the form \(SYMBOL SOMETHING) specially." (declare (indent 1) (debug if-let*)) (list 'if-let* varlist (macroexp-progn body))) (defmacro and-let* (varlist &rest body) - "Bind variables according to VARLIST and conditionally eval 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 non-nil." (declare (indent 1) @@ -157,22 +157,20 @@ are non-nil, then the result is non-nil." `(let* () ,@(or body '(t)))))) (defmacro if-let (spec then &rest else) - "Bind variables according to SPEC and eval THEN or ELSE. -Each binding is evaluated in turn, and evaluation stops if a -binding value is nil. If all are non-nil, the value of THEN is -returned, or the last form in ELSE is returned. + "Bind variables according to SPEC and evaluate THEN or ELSE. +Evaluate each binding in turn, stopping if a binding value is nil. +If all are non-nil return the value of THEN, otherwise the last form in ELSE. -Each element of SPEC is a list (SYMBOL VALUEFORM) which binds +Each element of SPEC is a list (SYMBOL VALUEFORM) that binds 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. It can also be of the form SYMBOL, then the binding of SYMBOL is checked for nil. -As a special case, a SPEC of the form \(SYMBOL SOMETHING) is -interpreted like \((SYMBOL SOMETHING)). This exists for backward -compatibility with the old syntax that accepted only one -binding." +As a special case, interprets a SPEC of the form \(SYMBOL SOMETHING) +like \((SYMBOL SOMETHING)). This exists for backward compatibility +with an old syntax that accepted only one binding." (declare (indent 2) (debug ([&or (&rest [&or symbolp (symbolp form) (form)]) (symbolp form)] @@ -184,10 +182,9 @@ binding." (list 'if-let* spec then (macroexp-progn else))) (defmacro when-let (spec &rest body) - "Bind variables according to SPEC and conditionally eval BODY. -Each binding is evaluated in turn, and evaluation stops if a -binding value is nil. If all are non-nil, the value of the last -form in BODY is returned. + "Bind variables according to SPEC and conditionally evaluate BODY. +Evaluate each binding in turn, stopping if a binding value is nil. +If all are non-nil, return the value of the last form in BODY. The variable list SPEC is the same as in `if-let'." (declare (indent 1) (debug if-let)) |