diff options
author | Earl Hyatt <okamsn@protonmail.com> | 2021-08-14 14:17:12 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-08-14 14:17:12 +0200 |
commit | c58f8dda2b2282302cf47ef3e7df6523bde606f5 (patch) | |
tree | ca39c4f866e2d1dfac5efbe94e7684790c65cbb8 /lisp/emacs-lisp | |
parent | adb6c3f1a4cc5ec3d26bfb2311dfc87b965153a0 (diff) | |
download | emacs-c58f8dda2b2282302cf47ef3e7df6523bde606f5.tar.gz emacs-c58f8dda2b2282302cf47ef3e7df6523bde606f5.tar.bz2 emacs-c58f8dda2b2282302cf47ef3e7df6523bde606f5.zip |
Add macro `seq-setq`.
* doc/lispref/sequences.texi (seq-setq): Document this macro.
* lisp/emacs-lisp/seq.el (seq-setq): New macro.
* test/lisp/emacs-lisp/seq-tests.el (test-seq-setq):
Test this macro (bug#50053).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/seq.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index e8fc4a28145..f0dc283f57d 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -93,6 +93,14 @@ name to be bound to the rest of SEQUENCE." (declare (indent 2) (debug (sexp form body))) `(pcase-let ((,(seq--make-pcase-patterns args) ,sequence)) ,@body)) + +(defmacro seq-setq (args sequence) + "Assign to the variables in ARGS the elements of SEQUENCE. + +ARGS can also include the `&rest' marker followed by a variable +name to be bound to the rest of SEQUENCE." + (declare (debug (sexp form))) + `(pcase-setq ,(seq--make-pcase-patterns args) ,sequence)) ;;; Basic seq functions that have to be implemented by new sequence types |