summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/pcase.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/pcase.el')
-rw-r--r--lisp/emacs-lisp/pcase.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 379b3ca69ba..289265abf27 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -89,7 +89,8 @@
(functionp &rest form)
sexp))
-(def-edebug-spec pcase-MACRO pcase--edebug-match-macro)
+;; See bug#24717
+(put 'pcase-MACRO 'edebug-form-spec 'pcase--edebug-match-macro)
;; Only called from edebug.
(declare-function get-edebug-spec "edebug" (symbol))
@@ -298,6 +299,8 @@ any kind of error."
;;;###autoload
(defmacro pcase-dolist (spec &rest body)
+ "Like `dolist' but where the binding can be a `pcase' pattern.
+\n(fn (PATTERN LIST) BODY...)"
(declare (indent 1) (debug ((pcase-PAT form) body)))
(if (pcase--trivial-upat-p (car spec))
`(dolist ,spec ,@body)
@@ -434,8 +437,10 @@ to this macro."
;; Don't use let*, otherwise macroexp-let* may merge it with some surrounding
;; let* which might prevent the setcar/setcdr in pcase--expand's fancy
;; codegen from later metamorphosing this let into a funcall.
- `(let ,(mapcar (lambda (b) (list (car b) (cdr b))) vars)
- ,@code))
+ (if vars
+ `(let ,(mapcar (lambda (b) (list (car b) (cdr b))) vars)
+ ,@code)
+ `(progn ,@code)))
(defun pcase--small-branch-p (code)
(and (= 1 (length code))
@@ -509,6 +514,7 @@ MATCH is the pattern that needs to be matched, of the form:
(numberp . stringp)
(numberp . byte-code-function-p)
(consp . arrayp)
+ (consp . atom)
(consp . vectorp)
(consp . stringp)
(consp . byte-code-function-p)