diff options
| author | Tino Calancha | 2018-09-29 18:06:03 +0900 |
|---|---|---|
| committer | Tino Calancha | 2018-09-29 18:06:15 +0900 |
| commit | 7296b6fbf27aeae76ea63ab2d9d9f2e46491b971 (patch) | |
| tree | cb488a359572bce734d0ff3fbc9a803dea10bb44 | |
| parent | d416109f06ab3910e3f49176185154a5179b6354 (diff) | |
| download | emacs-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.el | 39 |
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. |
| 1749 | First, each VAR is bound to the associated INIT value as if by a `let' form. | ||
| 1750 | Then, in each iteration of the loop, the END-TEST is evaluated; if true, | ||
| 1751 | the loop is finished. Otherwise, the BODY forms are evaluated, then each | ||
| 1752 | VAR is set to the associated STEP expression (as if by a `cl-psetq' form) | ||
| 1753 | and the next iteration begins. | ||
| 1754 | |||
| 1755 | Once the END-TEST becomes true, the RESULT forms are evaluated (with | ||
| 1756 | the VARs still bound to their values) to produce the result | ||
| 1757 | returned by `cl-do'. | ||
| 1758 | |||
| 1759 | Note that the entire loop is enclosed in an implicit `nil' block, so | ||
| 1760 | that you can use `cl-return' to exit at any time. | ||
| 1761 | |||
| 1762 | Also note that END-TEST is checked before evaluating BODY. If END-TEST | ||
| 1763 | is initially non-nil, `cl-do' will exit without running BODY. | ||
| 1764 | |||
| 1765 | For 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. |
| 1778 | First, each VAR is bound to the associated INIT value as if by a `let*' form. | ||
| 1779 | Then, in each iteration of the loop, the END-TEST is evaluated; if true, | ||
| 1780 | the loop is finished. Otherwise, the BODY forms are evaluated, then each | ||
| 1781 | VAR is set to the associated STEP expression (as if by a `setq' | ||
| 1782 | form) and the next iteration begins. | ||
| 1783 | |||
| 1784 | Once the END-TEST becomes true, the RESULT forms are evaluated (with | ||
| 1785 | the VARs still bound to their values) to produce the result | ||
| 1786 | returned by `cl-do*'. | ||
| 1787 | |||
| 1788 | Note that the entire loop is enclosed in an implicit `nil' block, so | ||
| 1789 | that you can use `cl-return' to exit at any time. | ||
| 1790 | |||
| 1791 | Also note that END-TEST is checked before evaluating BODY. If END-TEST | ||
| 1792 | is initially non-nil, `cl-do*' will exit without running BODY. | ||
| 1793 | |||
| 1794 | This is to `cl-do' what `let*' is to `let'. | ||
| 1795 | For 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)) |