branch: elpa/loopy
commit 65b03491bfcb8ea367cce7e242c18a7db41f956c
Author: okamsn <[email protected]>
Commit: GitHub <[email protected]>
Remove `loopy--obsolete-aliases`. (#256)
- Update README and CHANGELOG.
- In `tests/tests.el`:
- Delete `loopy--obsolete-aliases` from `loopy-vars.el` and its uses from
`loopy--get-command-parser` and `loopy--defalias-1`.
- Update tests to remove references to removed obsolete aliases:
- `loopy--set-destr-tests`: `expr`
- `loopy--set-value-tests`: `expr`
- `set-prev`: `prev-expr`
- `iteration-sub-level-command-do`: `group`
- `array-ref`: `arrayf`
- `map-ref`: `mapf`
- `numbers`: `nums`, `num`
- `numbers-down`: `numsdown`, `nums-down`
- `numbers-up`: `numsup`, `nums-up`
- `sequence`: `elements`
- `seq-index`: `arrayi`, `listi`, `stringi`, `sequencei`, `seqi`
- `sequence-ref`: `sequencef`
- `seq-ref`: `seqf`
- Rename destructuring tests for `set` from `expr-destr-%d-value`
to `set-destr-%d-value`.
- Delete test `custom-alias-obsolete-list-array`.
- In `tests/iter-tests.el`:
- Replace `expr` with `set` in tests:
- `wrap-catch`
- `dont-expand-quoted`
- `wrap-setq`
- `leave-in-let`
---
CHANGELOG.md | 4 ++
README.org | 2 +
lisp/loopy-commands.el | 4 --
lisp/loopy-vars.el | 50 +-----------------------
tests/iter-tests.el | 30 +++++++--------
tests/tests.el | 101 ++++++++++++++++++++-----------------------------
6 files changed, 63 insertions(+), 128 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aca641bbe36..377721fc9cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,10 +17,14 @@ For Loopy Dash, see <https://github.com/okamsn/loopy-dash>.
- Using accumulation commands with different initial values for the same
variable now signals an error instead of a warning ([#169], [#254]).
+- Aliases made obsolete in version 0.14.0 of this package have been removed
(see
+ release notes for that version below) ([#256]). They can still be added
+ manually to `loopy-parsers`.
[#169]: https://github.com/okamsn/loopy/issues/169
[#254]: https://github.com/okamsn/loopy/PR/254
[#251]: https://github.com/okamsn/loopy/PR/251
+[#256]: https://github.com/okamsn/loopy/PR/256
## 0.15.0
diff --git a/README.org b/README.org
index 03cea94b177..4b701b78ef9 100644
--- a/README.org
+++ b/README.org
@@ -38,6 +38,8 @@ please let me know.
- Unreleased:
- Using accumulation commands with different initial values for the same
variable now signals an error instead of a warning.
+ - Aliases made obsolete in version 0.14.0 have been removed. They can still
+ be added manually to ~loopy-parsers~.
- Version 0.15.0:
- Loopy now requires at least Emacs version 28.1, increased from version
27.1.
diff --git a/lisp/loopy-commands.el b/lisp/loopy-commands.el
index 41304a56230..b249781ab84 100644
--- a/lisp/loopy-commands.el
+++ b/lisp/loopy-commands.el
@@ -3059,10 +3059,6 @@ COMMAND-LIST."
Failing that, an error is signaled when ERROR is non-nil."
(or (map-elt loopy--parsers-internal command-name)
- (when-let* ((found (map-elt loopy--obsolete-aliases command-name)))
- (warn "`loopy': `%s' is an obsolete built-in alias of `%s'. It will
be removed in the future. To add it as a custom alias, add it to
`loopy-parsers'."
- command-name found)
- (map-elt loopy--parsers-internal found))
(when error
(signal 'loopy-unknown-command (list command-name)))))
diff --git a/lisp/loopy-vars.el b/lisp/loopy-vars.el
index 68cf5b8df5a..ed0f262532c 100644
--- a/lisp/loopy-vars.el
+++ b/lisp/loopy-vars.el
@@ -71,11 +71,7 @@ function in the variable `loopy--flag-settings'."
when (memq definition aliases)
return orig)
(and (map-contains-key loopy-parsers definition)
- definition)
- (when-let* ((orig (gethash definition loopy--obsolete-aliases)))
- (warn "`loopy': `%s' is an obsolete built-in alias of `%s'.
It will be removed in the future. To add it as a custom alias, add it to
`loopy-parsers'."
- definition orig)
- orig))))
+ definition))))
(if (eq alias true-name)
(error "Can't alias name to itself: `%s' -> `%s' -> ... -> `%s'"
alias definition true-name)
@@ -102,50 +98,6 @@ Definition must exist. Neither argument need be quoted."
`(loopy--defalias-1 (quote ,(loopy--get-quoted-symbol alias))
(quote ,(loopy--get-quoted-symbol definition))))
-(defvar loopy--obsolete-aliases
- #s(hash-table
- test eq
- data ( across array
- arrayf array-ref
- arrayingf array-ref
- stringf array-ref
- stringingf array-ref
- across-ref array-ref
- group command-do
- on cons
- in list
- listf list-ref
- listingf list-ref
- in-ref list-ref
- mapf map-ref
- mappingf map-ref
- num numbers
- nums numbers
- nums-down numbers-down
- numdown numbers-down
- num-down numbers-down
- numsdown numbers-down
- nums-up numbers-up
- numup numbers-up
- num-up numbers-up
- numsup numbers-up
- exprs set
- expr set
- prev set-prev
- prev-expr set-prev
- elements sequence
- sequencei sequence-index
- seqi sequence-index
- listi sequence-index
- arrayi sequence-index
- stringi sequence-index
- seqf seq-ref
- seqingf seq-ref
- sequencef sequence-ref
- sequencingf sequence-ref
- elements-ref sequence-ref))
- "Aliases to be removed from the documentation.")
-
(defun loopy--expression-parser-map-p (obj)
"Return when OBJ has the correct data for `loopy-expression-parsers'."
(and (mapp obj)
diff --git a/tests/iter-tests.el b/tests/iter-tests.el
index ed1235d45c6..489ac27416a 100644
--- a/tests/iter-tests.el
+++ b/tests/iter-tests.el
@@ -229,7 +229,7 @@
(ert-deftest wrap-catch ()
(should (= 5 (eval (quote (loopy-iter (for list i '(1 2 3 4 5 6 7))
(when (catch (progn
- (for expr tag 'my-tag)
+ (for set tag 'my-tag)
tag)
(for set j (1+ i))
(if (> j 5)
@@ -423,32 +423,32 @@ E.g., \"(let ((for list)) ...)\" should not try to
operate on the
(ert-deftest dont-expand-quoted ()
- (should (equal '((for expr i 2))
+ (should (equal '((for set i 2))
(eval
(quote
(loopy-iter (for cycle 1)
- (let ((j '(for expr i 2)))
+ (let ((j '(for set i 2)))
(accum collect j)))))))
- (should (equal '((for expr i 2))
+ (should (equal '((for set i 2))
(eval
(quote
(loopy-iter (cycling 1)
- (let ((j '(for expr i 2)))
+ (let ((j '(for set i 2)))
(collecting j)))))))
- (should (equal '((for expr i 2))
+ (should (equal '((for set i 2))
(eval
(quote
(loopy-iter (for cycle 1)
- (let ((j (quote (for expr i 2))))
+ (let ((j (quote (for set i 2))))
(accum collect j)))))))
- (should (equal '((for expr i 2))
+ (should (equal '((for set i 2))
(eval
(quote
(loopy-iter (cycling 1)
- (let ((j (quote (for expr i 2))))
+ (let ((j (quote (for set i 2))))
(collecting j))))))))
@@ -484,9 +484,9 @@ E.g., \"(let ((for list)) ...)\" should not try to operate
on the
j))
(collecting (cons a b)))))))
- (should (equal '((for expr i 2) (for expr i 2) (for expr i 2))
+ (should (equal '((for set i 2) (for set i 2) (for set i 2))
(eval (quote (loopy-iter (listing elem '(1 2 3))
- (setq a '(for expr i 2))
+ (setq a '(for set i 2))
(collecting a))))))
(should
@@ -500,9 +500,9 @@ E.g., \"(let ((for list)) ...)\" should not try to operate
on the
j))
(accum collect (cons a b)))))))
- (should (equal '((for expr i 2) (for expr i 2) (for expr i 2))
+ (should (equal '((for set i 2) (for set i 2) (for set i 2))
(eval (quote (loopy-iter (for list elem '(1 2 3))
- (setq a '(for expr i 2))
+ (setq a '(for set i 2))
(accum collect a)))))))
@@ -612,7 +612,7 @@ E.g., \"(let ((for list)) ...)\" should not try to operate
on the
(eval
(quote
(loopy-iter (let ((a (progn
- ;; NOTE: No restriction on placement of
`expr'.
+ ;; NOTE: No restriction on placement of
`set'.
(setting j 8 (1+ j))
(when (> j 12)
;; Leave loop but don't force return
value,
@@ -626,7 +626,7 @@ E.g., \"(let ((for list)) ...)\" should not try to operate
on the
(eval
(quote
(loopy-iter (let ((a (progn
- ;; NOTE: No restriction on placement of
`expr'.
+ ;; NOTE: No restriction on placement of
`set'.
(for set j 8 (1+ j))
(when (> j 12)
;; Leave loop but don't force return
value,
diff --git a/tests/tests.el b/tests/tests.el
index 3d6c5c981ce..323bdf52454 100644
--- a/tests/tests.el
+++ b/tests/tests.el
@@ -1074,7 +1074,7 @@ Make sure that it does not break early returns."
(cl-loop with list = '((1 2) (3 4) (5 6) (7 8))
for num from 1 to (length list)
for subseq = (cl-subseq list 0 num)
- collect `(loopy-deftest ,(intern (format "expr-destr-%d-value"
num))
+ collect `(loopy-deftest ,(intern (format "set-destr-%d-value" num))
:result (quote ,subseq)
:repeat _set
:body ((cycle ,num)
@@ -1082,11 +1082,11 @@ Make sure that it does not break early returns."
collect `(quote ,i)))
(collect coll (list i j))
(finally-return coll))
- :loopy ((_set . (set expr)))
+ :loopy ((_set . (set)))
:iter-bare ((_set . (setting))
(collect . collecting)
(cycle . cycling))
- :iter-keyword ((_set . (set expr))
+ :iter-keyword ((_set . (set))
(collect . collect)
(cycle . cycle))))))
@@ -1100,18 +1100,18 @@ Make sure that it does not break early returns."
for num in '(1 2 3 5)
for subseq = (cl-subseq list 0 num)
for result = (append subseq (make-list (- len num) num))
- collect `(loopy-deftest ,(intern (format "expr-%d-values" num))
+ collect `(loopy-deftest ,(intern (format "set-%d-values" num))
:result (quote ,result)
:repeat _set
:body ((cycle ,len)
(_set i ,@subseq)
(collect coll i)
(finally-return coll))
- :loopy ((_set . (set expr)))
+ :loopy ((_set . (set)))
:iter-bare ((_set . (setting))
(collect . collecting)
(cycle . cycling))
- :iter-keyword ((_set . (set expr))
+ :iter-keyword ((_set . (set))
(collect . collect)
(cycle . cycle))))))
@@ -1155,13 +1155,13 @@ Make sure that it does not break early returns."
(_set-prev j i)
(collect j))
:repeat _set-prev
- :loopy ((_set-prev . (set-prev prev-set prev-expr)))
+ :loopy ((_set-prev . (set-prev prev-set)))
:iter-bare ((list . listing)
(collect . collecting)
(_set-prev . (setting-prev)))
:iter-keyword ((list . list)
(collect . collect)
- (_set-prev . (set-prev prev-set prev-expr))))
+ (_set-prev . (set-prev prev-set))))
(loopy-deftest set-prev-keyword-back
:result '(nil nil nil 1 2)
@@ -1262,13 +1262,13 @@ Make sure that it does not break early returns."
:iter-keyword ((_cmd . ,plain-cmds))
:body ,body))
- (loopy-deftest iteration-sub-level-group
- :doc "Don't test `group' for `iter-bare'."
+ (loopy-deftest iteration-sub-level-command-do
+ :doc "Don't test `command-do' for `iter-bare'."
:error loopy-iteration-in-sub-level
:repeat _cmd
:loopy ((_cmd . ,plain-cmds))
:iter-keyword ((_cmd . ,plain-cmds))
- :body ((group (_cmd i '(1))) (finally-return t))))))
+ :body ((command-do (_cmd i '(1))) (finally-return t))))))
(test--iteration-sub-level)
@@ -1471,8 +1471,8 @@ Using numbers directly will use less variables and more
efficient code."
(do (setf i ?a))
(finally-return my-str))
:repeat _cmd
- :loopy ((_cmd . (array-ref string-ref arrayf stringf)))
- :iter-keyword ((_cmd . (array-ref string-ref arrayf stringf))
+ :loopy ((_cmd . (array-ref string-ref)))
+ :iter-keyword ((_cmd . (array-ref string-ref))
(do . do))
:iter-bare ((_cmd . (arraying-ref stringing-ref))
(do . ignore)))
@@ -2114,8 +2114,8 @@ Using numbers directly will use less variables and more
efficient code."
(do (cl-incf i 7))
(finally-return map))
:repeat _cmd
- :loopy ((_cmd . (map-ref mapf mapping-ref)))
- :iter-keyword ((_cmd . (map-ref mapf mapping-ref))
+ :loopy ((_cmd . (map-ref mapping-ref)))
+ :iter-keyword ((_cmd . (map-ref mapping-ref))
(do . do))
:iter-bare ((_cmd . (mapping-ref))
(do . ignore)))
@@ -2123,13 +2123,13 @@ Using numbers directly will use less variables and more
efficient code."
(loopy-deftest map-ref-:key
:result '([17 18 19 20 21] (0 1 2 3 4))
:body ((with (map (vector 10 11 12 13 14)))
- (mapf i map :key my-key)
+ (map-ref i map :key my-key)
(do (cl-incf i 7))
(collect my-key)
(finally-return map loopy-result))
:loopy t
- :iter-keyword (mapf do collect)
- :iter-bare ((mapf . mapping-ref)
+ :iter-keyword (do collect map-ref)
+ :iter-bare ((map-ref . mapping-ref)
(do . ignore)
(collect . collecting)))
@@ -2214,14 +2214,14 @@ Using numbers directly will use less variables and more
efficient code."
:iter-bare ((map-ref . mapping-ref)
(do . ignore)))
-;;;;; Nums
+;;;;; Numbers
(loopy-deftest numbers
:result '(1 2 3 4 5)
:repeat _cmd
:body ((_cmd i :from 1 :to 5)
(collect i))
- :loopy ((_cmd . (nums numbers num number)))
- :iter-keyword ((_cmd . (nums numbers num number))
+ :loopy ((_cmd . (numbers number)))
+ :iter-keyword ((_cmd . (numbers number))
(collect . collect))
:iter-bare ((_cmd . (numbering))
(collect . collecting)))
@@ -2476,28 +2476,28 @@ Using numbers directly will use less variables and more
efficient code."
:iter-bare ((collect . collecting)
(numbers . numbering)))
-;;;;; Nums-Down
+;;;;; Numbers-Down
(loopy-deftest numbers-down
:result '(10 8 6 4 2)
:multi-body t
:body [((_cmd i 10 1 :by 2) (collect i))
((_cmd i 10 1 2) (collect i))]
:repeat _cmd
- :loopy ((_cmd . (nums-down numsdown numbers-down)))
- :iter-keyword ((_cmd . (nums-down numsdown numbers-down))
+ :loopy ((_cmd . (numbers-down)))
+ :iter-keyword ((_cmd . (numbers-down))
(collect . collect))
:iter-keyword ((_cmd . (numbering-down))
(collect . collecting)))
-;;;;; Nums-Up
+;;;;; Numbers-Up
(loopy-deftest numbers-up
:result '(1 3 5 7 9)
:multi-body t
:body [((_cmd i 1 10 :by 2) (collect i))
((_cmd i 1 10 2) (collect i))]
:repeat _cmd
- :loopy ((_cmd . (nums-up numsup numbers-up)))
- :iter-keyword ((_cmd . (nums-up numsup numbers-up))
+ :loopy ((_cmd . (numbers-up)))
+ :iter-keyword ((_cmd . (numbers-up))
(collect . collect))
:iter-keyword ((_cmd . (numbering-up))
(collect . collecting)))
@@ -2567,8 +2567,8 @@ Using numbers directly will use less variables and more
efficient code."
(return nil))
(finally-return t))
:repeat _cmd
- :loopy ((_cmd . (sequence sequencing elements)))
- :iter-keyword ((_cmd . (sequence sequencing elements))
+ :loopy ((_cmd . (sequence sequencing)))
+ :iter-keyword ((_cmd . (sequence sequencing))
(return . return))
:iter-bare ((sequence . (sequencing))
(return . returning)))
@@ -3125,17 +3125,17 @@ are records, which are sequences, so they still work in
that way."
((with (my-seq "abc")) (_cmd i my-seq) (collect (elt my-seq i)))
((with (my-seq '(97 98 99))) (_cmd i my-seq) (collect (elt my-seq
i)))]
:repeat _cmd
- :loopy ((_cmd . ( array-index arraying-index arrayi
- list-index listing-index listi
- string-index stringing-index stringi
+ :loopy ((_cmd . ( array-index arraying-index
+ list-index listing-index
+ string-index stringing-index
sequence-index sequencing-index
- sequencei seqi seqing-index))
+ seqing-index))
(collect . collect))
- :iter-keyword ((_cmd . ( array-index arraying-index arrayi
- list-index listing-index listi
- string-index stringing-index stringi
+ :iter-keyword ((_cmd . ( array-index arraying-index
+ list-index listing-index
+ string-index stringing-index
sequence-index sequencing-index
- sequencei seqi seqing-index))
+ seqing-index))
(collect . collect))
:iter-bare ((_cmd . ( arraying-index listing-index stringing-index
sequencing-index seqing-index))
@@ -3332,8 +3332,8 @@ are records, which are sequences, so they still work in
that way."
(do (setf i 7))
(finally-return my-seq))
:repeat _cmd
- :loopy ((_cmd . (sequence-ref sequencef sequence-ref)))
- :iter-keyword ((_cmd . (sequence-ref sequencef sequence-ref))
+ :loopy ((_cmd . (sequence-ref sequence-ref)))
+ :iter-keyword ((_cmd . (sequence-ref sequence-ref))
(do . do))
:iter-bare ((_cmd . (sequencing-ref))
(do . ignore)))
@@ -3547,8 +3547,8 @@ are records, which are sequences, so they still work in
that way."
(do (setf i 7))
(finally-return my-seq))
:repeat _cmd
- :loopy ((_cmd . (seq-ref seqing-ref seqf)))
- :iter-keyword ((_cmd . (seq-ref seqing-ref seqf))
+ :loopy ((_cmd . (seq-ref seqing-ref)))
+ :iter-keyword ((_cmd . (seq-ref seqing-ref))
(do . do))
:iter-bare ((_cmd . (seqing-ref))
(do . ignore)))
@@ -7003,25 +7003,6 @@ This assumes that you're on guix."
(set . setting)))
;;; Custom Aliases
-(loopy-deftest custom-alias-obsolete-list-array
- :doc "Test aliasing to obsolete command names.
-NOTE: This should eventually be removed."
- :result '((1 . 4) (2 . 5) (3 . 6))
- :wrap ((x . `(let ((loopy-aliases (map-copy loopy-aliases))
- (loopy-iter-bare-commands
- (append (list 'my-list2 'my-array2)
loopy-iter-bare-commands)))
- (loopy-defalias my-list2 in)
- (loopy-defalias my-array2 'across)
- (eval (quote ,x)
- t))))
- :body ((my-list2 i '(1 2 3))
- (my-array2 j [4 5 6])
- (collect (cons i j)))
- :loopy t
- :iter-keyword (my-list2 my-array2 collect)
- :iter-bare ((my-list2 . my-list2)
- (my-array2 . my-array2)
- (collect . collecting)))
(loopy-deftest custom-alias-flag
:doc "Test with `default' flag, which is essentially a no-op."