Skip to content

Commit 60327b8

Browse files
committed
Obsolete more built-in aliases.
- Make `command-do` the default name and `group` the obsolete alias. - Rename `loopy--parse-group-command` to `loopy--parse-command-do-command`. -
1 parent 38126cc commit 60327b8

File tree

4 files changed

+12
-22
lines changed

4 files changed

+12
-22
lines changed

doc/loopy-doc.org

+1-11
Original file line numberDiff line numberDiff line change
@@ -1303,9 +1303,8 @@ value and do no affect how the loop iterates.
13031303
(do (message "%d" i)))
13041304
#+END_SRC
13051305

1306-
#+findex: group
13071306
#+findex: command-do
1308-
- =(group|command-do [CMDS])= :: Evaluate multiple loop commands, as if in a
1307+
- =(command-do [CMDS])= :: Evaluate multiple loop commands, as if in a
13091308
=progn=. This is similar to =do=, but runs commands instead of normal Lisp
13101309
expressions. Currently, this command is only useful when used within the
13111310
=if= command.
@@ -1314,15 +1313,6 @@ value and do no affect how the loop iterates.
13141313
;; Report whether an even number is found, or return the sum of
13151314
;; the list's elements. To be clear, this is not an idiomatic example.
13161315

1317-
;; Returns sum:
1318-
;; => 9
1319-
(loopy (list i '(1 3 5))
1320-
(if (cl-evenp i)
1321-
(group
1322-
(do (message "Even found."))
1323-
(return i))
1324-
(sum i)))
1325-
13261316
;; Returns the detected even number:
13271317
;; => 2
13281318
(loopy (list i '(1 3 2 5))

loopy-commands.el

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ This command does not wait for VAL to change before updating VAR."
265265
(loopy--latter-body (setq ,cnt (1+ ,cnt)))))))))
266266

267267
;;;;;; Group
268-
(cl-defun loopy--parse-group-command ((_ &rest body))
269-
"Parse the `group' loop command.
268+
(cl-defun loopy--parse-command-do-command ((_ &rest body))
269+
"Parse the `command-do' loop command.
270270
271271
BODY is one or more commands to be grouped by a `progn' form.
272272
This command is suitable for using as the first sub-command in an

loopy-vars.el

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Definition must exist. Neither argument need be quoted."
7777
(defvar loopy--obsolete-aliases
7878
'((array across)
7979
(array-ref arrayf arrayingf stringf stringingf across-ref)
80+
(command-do group)
8081
(cons on)
8182
(list in)
8283
(list-ref listf listingf in-ref)
@@ -179,7 +180,7 @@ true names and lists of aliases.
179180
(array-ref . loopy--parse-array-ref-command)
180181
(at . loopy--parse-at-command)
181182
(collect . loopy--parse-collect-command)
182-
(command-do . loopy--parse-group-command)
183+
(command-do . loopy--parse-command-do-command)
183184
(concat . loopy--parse-concat-command)
184185
(cond . loopy--parse-cond-command)
185186
(cons . loopy--parse-cons-command)
@@ -188,7 +189,6 @@ true names and lists of aliases.
188189
(do . loopy--parse-do-command)
189190
(find . loopy--parse-find-command)
190191
(set-accum . loopy--parse-set-accum-command)
191-
(group . loopy--parse-group-command)
192192
(if . loopy--parse-if-command)
193193
(iter . loopy--parse-iter-command)
194194
(leave . loopy--parse-leave-command)

tests/tests.el

+7-7
Original file line numberDiff line numberDiff line change
@@ -844,20 +844,20 @@ SYMS-STR are the string names of symbols from `loopy-iter-bare-commands'."
844844
:iter-bare ((set . setting)
845845
(return . returning)))
846846

847-
;;;;; Group
848-
(loopy-deftest group
847+
;;;;; command-do
848+
(loopy-deftest command-do
849849
:result '((2 4 6) (2 4 6))
850850
:body ((list i '(1 2 3 4 5 6))
851851
(if (cl-evenp i)
852-
(_group (collect c1 i)
853-
(collect c2 i)))
852+
(_command-do (collect c1 i)
853+
(collect c2 i)))
854854
(finally-return c1 c2))
855-
:repeat _group
856-
:loopy ((_group . (group command-do)))
855+
:repeat _command-do
856+
:loopy ((_command-do . (command-do command-do)))
857857
;; Technically don't need to test (and wouldn't work if we used `for' inside,
858858
;; anyway).
859859
:iter-keyword ((list . list)
860-
(_group . (group command-do))))
860+
(_command-do . (command-do command-do))))
861861

862862
;;;;; Set-Prev
863863
(loopy-deftest set-prev

0 commit comments

Comments
 (0)