aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTino Calancha2018-09-29 18:06:03 +0900
committerTino Calancha2018-09-29 18:06:15 +0900
commit7296b6fbf27aeae76ea63ab2d9d9f2e46491b971 (patch)
treecb488a359572bce734d0ff3fbc9a803dea10bb44
parentd416109f06ab3910e3f49176185154a5179b6354 (diff)
downloademacs-7296b6fbf27aeae76ea63ab2d9d9f2e46491b971.tar.gz
emacs-7296b6fbf27aeae76ea63ab2d9d9f2e46491b971.zip
Improve cl-do, cl-do* docstrings
* lisp/emacs-lisp/cl-macs.el(cl-do, cl-do*): Improve docstring (Bug#32803).
-rw-r--r--lisp/emacs-lisp/cl-macs.el39
1 files changed, 37 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 0854e665b9b..ffe88a21a85 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1745,7 +1745,24 @@ such that COMBO is equivalent to (and . CLAUSES)."
1745 1745
1746;;;###autoload 1746;;;###autoload
1747(defmacro cl-do (steps endtest &rest body) 1747(defmacro cl-do (steps endtest &rest body)
1748 "The Common Lisp `do' loop. 1748 "Bind variables and run BODY forms until END-TEST returns non-nil.
1749First, each VAR is bound to the associated INIT value as if by a `let' form.
1750Then, in each iteration of the loop, the END-TEST is evaluated; if true,
1751the loop is finished. Otherwise, the BODY forms are evaluated, then each
1752VAR is set to the associated STEP expression (as if by a `cl-psetq' form)
1753and the next iteration begins.
1754
1755Once the END-TEST becomes true, the RESULT forms are evaluated (with
1756the VARs still bound to their values) to produce the result
1757returned by `cl-do'.
1758
1759Note that the entire loop is enclosed in an implicit `nil' block, so
1760that you can use `cl-return' to exit at any time.
1761
1762Also note that END-TEST is checked before evaluating BODY. If END-TEST
1763is initially non-nil, `cl-do' will exit without running BODY.
1764
1765For more details, see `cl-do' description in Info node `(cl) Iteration'.
1749 1766
1750\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" 1767\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
1751 (declare (indent 2) 1768 (declare (indent 2)
@@ -1757,7 +1774,25 @@ such that COMBO is equivalent to (and . CLAUSES)."
1757 1774
1758;;;###autoload 1775;;;###autoload
1759(defmacro cl-do* (steps endtest &rest body) 1776(defmacro cl-do* (steps endtest &rest body)
1760 "The Common Lisp `do*' loop. 1777 "Bind variables and run BODY forms until END-TEST returns non-nil.
1778First, each VAR is bound to the associated INIT value as if by a `let*' form.
1779Then, in each iteration of the loop, the END-TEST is evaluated; if true,
1780the loop is finished. Otherwise, the BODY forms are evaluated, then each
1781VAR is set to the associated STEP expression (as if by a `setq'
1782form) and the next iteration begins.
1783
1784Once the END-TEST becomes true, the RESULT forms are evaluated (with
1785the VARs still bound to their values) to produce the result
1786returned by `cl-do*'.
1787
1788Note that the entire loop is enclosed in an implicit `nil' block, so
1789that you can use `cl-return' to exit at any time.
1790
1791Also note that END-TEST is checked before evaluating BODY. If END-TEST
1792is initially non-nil, `cl-do*' will exit without running BODY.
1793
1794This is to `cl-do' what `let*' is to `let'.
1795For more details, see `cl-do*' description in Info node `(cl) Iteration'.
1761 1796
1762\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" 1797\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
1763 (declare (indent 2) (debug cl-do)) 1798 (declare (indent 2) (debug cl-do))