summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/pcase.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2010-09-30 01:28:20 +0200
committerStefan Monnier <monnier@iro.umontreal.ca>2010-09-30 01:28:20 +0200
commita01a7932080e8a6e7bc8472c58cefabcc2c37df3 (patch)
tree94b28b19c8f1536e76ffe7d5826811b74a79e3a5 /lisp/emacs-lisp/pcase.el
parentcc390e46c7ba95b76ea133d98fd386214cd01709 (diff)
parent6b0f7311f16646e0de2045b2410e20921901c616 (diff)
downloademacs-a01a7932080e8a6e7bc8472c58cefabcc2c37df3.tar.gz
emacs-a01a7932080e8a6e7bc8472c58cefabcc2c37df3.tar.bz2
emacs-a01a7932080e8a6e7bc8472c58cefabcc2c37df3.zip
Merge from trunk
Diffstat (limited to 'lisp/emacs-lisp/pcase.el')
-rw-r--r--lisp/emacs-lisp/pcase.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index b2b27a0e0d6..b922e0b0233 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -76,8 +76,8 @@ BODY should be an expression, and BINDINGS should be a list of bindings
of the form (UPAT EXP)."
(if (null bindings) body
`(pcase ,(cadr (car bindings))
- (,(caar bindings) (plet* ,(cdr bindings) ,body))
- (t (error "Pattern match failure in `plet'")))))
+ (,(caar bindings) (pcase-let* ,(cdr bindings) ,body))
+ (t (error "Pattern match failure in `pcase-let'")))))
;;;###autoload
(defmacro pcase-let (bindings body)
@@ -85,13 +85,14 @@ of the form (UPAT EXP)."
BODY should be an expression, and BINDINGS should be a list of bindings
of the form (UPAT EXP)."
(if (null (cdr bindings))
- `(plet* ,bindings ,body)
+ `(pcase-let* ,bindings ,body)
(setq bindings (mapcar (lambda (x) (cons (make-symbol "x") x)) bindings))
`(let ,(mapcar (lambda (binding) (list (nth 0 binding) (nth 2 binding)))
bindings)
- (plet* ,(mapcar (lambda (binding) (list (nth 1 binding) (nth 0 binding)))
- bindings)
- ,body))))
+ (pcase-let*
+ ,(mapcar (lambda (binding) (list (nth 1 binding) (nth 0 binding)))
+ bindings)
+ ,body))))
(defun pcase-expand (exp cases)
(let* ((defs (if (symbolp exp) '()