emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 84e207c: * lisp/emacs-lisp/subr-x.el (if-let*, if-let): Use loose


From: Stefan Monnier
Subject: master 84e207c: * lisp/emacs-lisp/subr-x.el (if-let*, if-let): Use looser Edebug spec
Date: Sat, 22 May 2021 10:22:48 -0400 (EDT)

branch: master
commit 84e207c81187ff46fb94775ccb24d9b76b80db9c
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * 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.
---
 lisp/emacs-lisp/subr-x.el | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 72406df..1c13c39 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]