summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2021-05-22 10:21:59 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2021-05-22 10:21:59 -0400
commit84e207c81187ff46fb94775ccb24d9b76b80db9c (patch)
tree2d61869fc98242e662333617fbcbf9f4022199c9 /lisp
parent43fd13770a8ac8452669e4de3281e9189cb36c5a (diff)
downloademacs-84e207c81187ff46fb94775ccb24d9b76b80db9c.tar.gz
emacs-84e207c81187ff46fb94775ccb24d9b76b80db9c.tar.bz2
emacs-84e207c81187ff46fb94775ccb24d9b76b80db9c.zip
* lisp/emacs-lisp/subr-x.el (if-let*, if-let): Use looser Edebug spec
This makes the same spec work both for `if-let` and `when-let`. (when-let*, and-let*, when-let): Simplify accordingly.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emacs-lisp/subr-x.el17
1 files changed, 5 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 72406df0ff7..1c13c398dde 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -127,7 +127,7 @@ This is like `if-let' but doesn't handle a VARLIST of the form
\(SYMBOL SOMETHING) specially."
(declare (indent 2)
(debug ((&rest [&or symbolp (symbolp form) (form)])
- form body)))
+ body)))
(if varlist
`(let* ,(setq varlist (internal--build-bindings varlist))
(if ,(caar (last varlist))
@@ -139,18 +139,14 @@ This is like `if-let' but doesn't handle a VARLIST of the form
"Bind variables according to VARLIST and conditionally evaluate BODY.
This is like `when-let' but doesn't handle a VARLIST of the form
\(SYMBOL SOMETHING) specially."
- (declare (indent 1)
- (debug ((&rest [&or symbolp (symbolp form) (form)])
- body)))
+ (declare (indent 1) (debug if-let*))
(list 'if-let* varlist (macroexp-progn body)))
(defmacro and-let* (varlist &rest body)
"Bind variables according to VARLIST and conditionally evaluate BODY.
Like `when-let*', except if BODY is empty and all the bindings
are non-nil, then the result is non-nil."
- (declare (indent 1)
- (debug ((&rest [&or symbolp (symbolp form) (form)])
- body)))
+ (declare (indent 1) (debug if-let*))
(let (res)
(if varlist
`(let* ,(setq varlist (internal--build-bindings varlist))
@@ -178,7 +174,7 @@ with an old syntax that accepted only one binding."
(declare (indent 2)
(debug ([&or (symbolp form) ; must be first, Bug#48489
(&rest [&or symbolp (symbolp form) (form)])]
- form body)))
+ body)))
(when (and (<= (length spec) 2)
(not (listp (car spec))))
;; Adjust the single binding case
@@ -192,10 +188,7 @@ Evaluate each binding in turn, stopping if a binding value is nil.
If all are non-nil, return the value of the last form in BODY.
The variable list SPEC is the same as in `if-let'."
- (declare (indent 1)
- (debug ([&or (symbolp form) ; must be first, Bug#48489
- (&rest [&or symbolp (symbolp form) (form)])]
- body)))
+ (declare (indent 1) (debug if-let))
(list 'if-let spec (macroexp-progn body)))
(defsubst hash-table-empty-p (hash-table)