[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master c9a75cf: [el-search] Fix more "redundant _ pattern" warnin
From: |
Michael Heerdegen |
Subject: |
[elpa] master c9a75cf: [el-search] Fix more "redundant _ pattern" warnings |
Date: |
Fri, 21 Dec 2018 16:25:56 -0500 (EST) |
branch: master
commit c9a75cf92b07501af608d4449c16b787f65a7f9f
Author: Michael Heerdegen <address@hidden>
Commit: Michael Heerdegen <address@hidden>
[el-search] Fix more "redundant _ pattern" warnings
Also bump version to 1.8.7.
* packages/el-search/el-search.el (el-search-make-matcher): Handle
symbols directly as catchall patterns. Remove redundant second pcase
branch.
* packages/el-search/el-search-x.el (append): Handle one more corner
case specially.
---
packages/el-search/el-search-x.el | 8 +++++---
packages/el-search/el-search.el | 17 ++++++++++-------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/packages/el-search/el-search-x.el
b/packages/el-search/el-search-x.el
index 0af955c..58b5251 100644
--- a/packages/el-search/el-search-x.el
+++ b/packages/el-search/el-search-x.el
@@ -95,8 +95,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)
@@ -106,7 +108,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 1edb198..65e2dfd 100644
--- a/packages/el-search/el-search.el
+++ b/packages/el-search/el-search.el
@@ -7,7 +7,7 @@
;; Created: 29 Jul 2015
;; Keywords: lisp
;; Compatibility: GNU Emacs 25
-;; Version: 1.8.6
+;; Version: 1.8.7
;; Package-Requires: ((emacs "25") (stream "2.2.4") (cl-print "1.0"))
@@ -1073,14 +1073,17 @@ 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 (memq pattern '(_ t)))
+ (pattern-is-symbol (and (symbolp pattern)
+ (not (or (keywordp pattern)
+ (null pattern))))))
(byte-compile
`(lambda (,(if pattern-is-catchall '_ expression))
- ,(if pattern-is-catchall
- (if result-specified result-expr t)
- `(pcase ,expression
- (,pattern ,(if result-specified result-expr t))
- (_ nil)))))))))
+ ,(cond
+ (pattern-is-catchall (if result-specified result-expr t))
+ ((and pattern-is-symbol (not result-specified)) t)
+ (t `(pcase ,expression
+ (,pattern ,(if result-specified result-expr t)))))))))))
(defun el-search--match-p (matcher expression)
(funcall matcher expression))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] master c9a75cf: [el-search] Fix more "redundant _ pattern" warnings,
Michael Heerdegen <=