emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] scratch/mheerdegen-preview 73bca9f 12/32: WIP [el-search] Fix mor


From: Michael Heerdegen
Subject: [elpa] scratch/mheerdegen-preview 73bca9f 12/32: WIP [el-search] Fix more "redundant _ pattern" cases
Date: Sat, 20 Oct 2018 18:18:59 -0400 (EDT)

branch: scratch/mheerdegen-preview
commit 73bca9f0db56dc93b22559d1fcb382a5b82d4c7a
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>

    WIP [el-search] Fix more "redundant _ pattern" cases
---
 packages/el-search/el-search-x.el | 8 +++++---
 packages/el-search/el-search.el   | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/packages/el-search/el-search-x.el 
b/packages/el-search/el-search-x.el
index a2f37c4..03b3acf 100644
--- a/packages/el-search/el-search-x.el
+++ b/packages/el-search/el-search-x.el
@@ -104,8 +104,10 @@ Example: the pattern
    (append '(1 2 3) x (app car-safe 7))
 
 matches the list (1 2 3 4 5 6 7 8 9), binding `x' to (4 5 6)."
-  (if (null patterns)
-      '(pred null)
+  (cond
+   ((null patterns)       '(pred null))
+   ((equal patterns '(_)) '(pred listp))
+   (t
     (pcase-let ((`(,pattern . ,more-patterns) patterns))
       (cond
        ((null more-patterns) pattern)
@@ -115,7 +117,7 @@ matches the list (1 2 3 4 5 6 7 8 9), binding `x' to (4 5 
6)."
                                      (el-search-make-matcher pattern)
                                      (el-search-make-matcher (car 
more-patterns)))
                    `(,,pattern ,,(car more-patterns)))))
-       (t `(append ,pattern (append ,@more-patterns)))))))
+       (t `(append ,pattern (append ,@more-patterns))))))))
 
 (defcustom el-search-lazy-l t
   "Whether to interpret symbols and strings specially in `l'.
diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el
index 4faba21..05f5de8 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -1095,7 +1095,7 @@ N times."
      (defvar warning-suppress-log-types)
      (let ((byte-compile-debug t) ;make undefined pattern types raise an error
            (warning-suppress-log-types '((bytecomp)))
-           (pattern-is-catchall (eq pattern '_)))
+           (pattern-is-catchall (and (symbolp pattern) (not (keywordp 
pattern)))))
        (byte-compile
         `(lambda (,(if pattern-is-catchall '_ expression))
            ,(if pattern-is-catchall



reply via email to

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