1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

Add a `pcase-setq' macro

* doc/lispref/control.texi (Destructuring with pcase Patterns):
Document this macro.

* lisp/emacs-lisp/pcase.el (pcase-setq): New macro.  This macro is
the 'setq' equivalent of 'pcase-let'.

* test/lisp/emacs-lisp/pcase-tests.el (pcase-setq): Test this new
macro. (bug#49809).
This commit is contained in:
Earl Hyatt 2021-08-11 23:54:31 +02:00 committed by Lars Ingebrigtsen
parent 3b5f8ab0d0
commit 2f90fa19b8
4 changed files with 94 additions and 0 deletions

View file

@ -1312,6 +1312,10 @@ element of @var{list}. The bindings are performed as if by
up being equivalent to @code{dolist} (@pxref{Iteration}).
@end defmac
@defmac pcase-setq pattern value@dots{}
Assign values to variables in a @code{setq} form, destructuring each
@var{value} according to its respective @var{pattern}.
@end defmac
@node Iteration
@section Iteration