emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117962: * lisp/emacs-lisp/pcase.el (pcase--split-ma


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r117962: * lisp/emacs-lisp/pcase.el (pcase--split-match, pcase--app-subst-match):
Date: Sat, 27 Sep 2014 04:24:11 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117962
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18554
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Sat 2014-09-27 00:24:06 -0400
message:
  * lisp/emacs-lisp/pcase.el (pcase--split-match, pcase--app-subst-match):
  Handle the case where `match' is :pcase--succeed or :pcase--fail.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/emacs-lisp/pcase.el       pcase.el-20100810123717-8zwve3391p2ywm1h-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-09-27 03:57:41 +0000
+++ b/lisp/ChangeLog    2014-09-27 04:24:06 +0000
@@ -1,5 +1,9 @@
 2014-09-27  Stefan Monnier  <address@hidden>
 
+       * emacs-lisp/pcase.el (pcase--split-match, pcase--app-subst-match):
+       Handle the case where `match' is :pcase--succeed or :pcase--fail
+       (bug#18554).
+
        Introduce global-eldoc-mode.  Move Elisp-specific code to elisp-mode.el.
        * emacs-lisp/eldoc.el (global-eldoc-mode): New minor mode.
        (eldoc-schedule-timer): Obey it.

=== modified file 'lisp/emacs-lisp/pcase.el'
--- a/lisp/emacs-lisp/pcase.el  2014-09-22 18:05:22 +0000
+++ b/lisp/emacs-lisp/pcase.el  2014-09-27 04:24:06 +0000
@@ -435,12 +435,12 @@
 
 (defun pcase--split-match (sym splitter match)
   (cond
-    ((eq (car match) 'match)
+    ((eq (car-safe match) 'match)
      (if (not (eq sym (cadr match)))
          (cons match match)
        (let ((res (funcall splitter (cddr match))))
          (cons (or (car res) match) (or (cdr res) match)))))
-    ((memq (car match) '(or and))
+    ((memq (car-safe match) '(or and))
      (let ((then-alts '())
            (else-alts '())
            (neutral-elem (if (eq 'or (car match))
@@ -460,6 +460,7 @@
                    ((null else-alts) neutral-elem)
                    ((null (cdr else-alts)) (car else-alts))
                    (t (cons (car match) (nreverse else-alts)))))))
+    ((memq match '(:pcase--succeed :pcase--fail)) (cons match match))
     (t (error "Uknown MATCH %s" match))))
 
 (defun pcase--split-rest (sym splitter rest)
@@ -570,17 +571,18 @@
 
 (defun pcase--app-subst-match (match sym fun nsym)
   (cond
-   ((eq (car match) 'match)
+   ((eq (car-safe match) 'match)
     (if (and (eq sym (cadr match))
              (eq 'app (car-safe (cddr match)))
              (equal fun (nth 1 (cddr match))))
         (pcase--match nsym (nth 2 (cddr match)))
       match))
-   ((memq (car match) '(or and))
+   ((memq (car-safe match) '(or and))
     `(,(car match)
       ,@(mapcar (lambda (match)
                   (pcase--app-subst-match match sym fun nsym))
                 (cdr match))))
+   ((memq match '(:pcase--succeed :pcase--fail)) match)
    (t (error "Uknown MATCH %s" match))))
 
 (defun pcase--app-subst-rest (rest sym fun nsym)


reply via email to

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