aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/emacs-lisp/pcase.el10
2 files changed, 10 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e43bace2a66..146dda5b9cd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12014-09-27 Stefan Monnier <monnier@iro.umontreal.ca> 12014-09-27 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * emacs-lisp/pcase.el (pcase--split-match, pcase--app-subst-match):
4 Handle the case where `match' is :pcase--succeed or :pcase--fail
5 (bug#18554).
6
3 Introduce global-eldoc-mode. Move Elisp-specific code to elisp-mode.el. 7 Introduce global-eldoc-mode. Move Elisp-specific code to elisp-mode.el.
4 * emacs-lisp/eldoc.el (global-eldoc-mode): New minor mode. 8 * emacs-lisp/eldoc.el (global-eldoc-mode): New minor mode.
5 (eldoc-schedule-timer): Obey it. 9 (eldoc-schedule-timer): Obey it.
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index ddcd4040f2b..753cd3005e6 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -435,12 +435,12 @@ MATCH is the pattern that needs to be matched, of the form:
435 435
436(defun pcase--split-match (sym splitter match) 436(defun pcase--split-match (sym splitter match)
437 (cond 437 (cond
438 ((eq (car match) 'match) 438 ((eq (car-safe match) 'match)
439 (if (not (eq sym (cadr match))) 439 (if (not (eq sym (cadr match)))
440 (cons match match) 440 (cons match match)
441 (let ((res (funcall splitter (cddr match)))) 441 (let ((res (funcall splitter (cddr match))))
442 (cons (or (car res) match) (or (cdr res) match))))) 442 (cons (or (car res) match) (or (cdr res) match)))))
443 ((memq (car match) '(or and)) 443 ((memq (car-safe match) '(or and))
444 (let ((then-alts '()) 444 (let ((then-alts '())
445 (else-alts '()) 445 (else-alts '())
446 (neutral-elem (if (eq 'or (car match)) 446 (neutral-elem (if (eq 'or (car match))
@@ -460,6 +460,7 @@ MATCH is the pattern that needs to be matched, of the form:
460 ((null else-alts) neutral-elem) 460 ((null else-alts) neutral-elem)
461 ((null (cdr else-alts)) (car else-alts)) 461 ((null (cdr else-alts)) (car else-alts))
462 (t (cons (car match) (nreverse else-alts))))))) 462 (t (cons (car match) (nreverse else-alts)))))))
463 ((memq match '(:pcase--succeed :pcase--fail)) (cons match match))
463 (t (error "Uknown MATCH %s" match)))) 464 (t (error "Uknown MATCH %s" match))))
464 465
465(defun pcase--split-rest (sym splitter rest) 466(defun pcase--split-rest (sym splitter rest)
@@ -570,17 +571,18 @@ MATCH is the pattern that needs to be matched, of the form:
570 571
571(defun pcase--app-subst-match (match sym fun nsym) 572(defun pcase--app-subst-match (match sym fun nsym)
572 (cond 573 (cond
573 ((eq (car match) 'match) 574 ((eq (car-safe match) 'match)
574 (if (and (eq sym (cadr match)) 575 (if (and (eq sym (cadr match))
575 (eq 'app (car-safe (cddr match))) 576 (eq 'app (car-safe (cddr match)))
576 (equal fun (nth 1 (cddr match)))) 577 (equal fun (nth 1 (cddr match))))
577 (pcase--match nsym (nth 2 (cddr match))) 578 (pcase--match nsym (nth 2 (cddr match)))
578 match)) 579 match))
579 ((memq (car match) '(or and)) 580 ((memq (car-safe match) '(or and))
580 `(,(car match) 581 `(,(car match)
581 ,@(mapcar (lambda (match) 582 ,@(mapcar (lambda (match)
582 (pcase--app-subst-match match sym fun nsym)) 583 (pcase--app-subst-match match sym fun nsym))
583 (cdr match)))) 584 (cdr match))))
585 ((memq match '(:pcase--succeed :pcase--fail)) match)
584 (t (error "Uknown MATCH %s" match)))) 586 (t (error "Uknown MATCH %s" match))))
585 587
586(defun pcase--app-subst-rest (rest sym fun nsym) 588(defun pcase--app-subst-rest (rest sym fun nsym)