From 8fa0d9679d25c431bfe2da3d93997f5ed222ce35 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 1 Dec 2018 17:21:29 -0800 Subject: [PATCH] * lisp/emacs-lisp/subr-x.el (if-let, when-let): Doc fix: active voice. --- lisp/emacs-lisp/subr-x.el | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 7fab9083e85..2e24d5607bf 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)) -- 2.39.2