[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 9ac0f0f 111/350: Searching on empty strings should
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 9ac0f0f 111/350: Searching on empty strings should happen in field-search method |
Date: |
Mon, 14 Aug 2017 11:46:17 -0400 (EDT) |
branch: externals/ebdb
commit 9ac0f0f4cafeedd40bdcc2fd18bf25aeab70b586
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Searching on empty strings should happen in field-search method
* ebdb.el (ebdb-record-search): There's no reason to do the check
here.
* ebdb.el (ebdb-field-search): Instead, do it here. I suppose this
could even be an :around method on ebdb-field-search, to
short-circuit the test.
---
ebdb.el | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/ebdb.el b/ebdb.el
index 6620a91..3bea000 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -4508,7 +4508,8 @@ interpreted as t, ie the record passes."
(cl-defmethod ebdb-field-search ((field ebdb-field) (regex string))
(condition-case nil
- (string-match-p regex (ebdb-string field))
+ (or (string-empty-p regex)
+ (string-match-p regex (ebdb-string field)))
(cl-no-applicable-method nil)))
(cl-defmethod ebdb-field-search ((field ebdb-field-labeled) (pair cons))
@@ -4518,7 +4519,6 @@ interpreted as t, ie the record passes."
(string-empty-p label)
(string-match-p label (slot-value field 'object-name)))
(or (null value)
- (string-empty-p value)
(ebdb-field-search field value)))))
(cl-defmethod ebdb-field-search ((_field ebdb-field-name-complex) _regex)
@@ -4583,20 +4583,20 @@ values, by default the search is not handed to the name
field itself."
(catch 'found
(pcase search-clause
(`(* ,(and regexp (pred stringp)))
- ;; check all user fields
+ ;; Check all user fields.
(dolist (f (ebdb-record-user-fields record))
(when (ebdb-field-search f regexp)
- (throw 'found t)))
- ;; so that "^$" can be used to find records that
- ;; have no notes
- (when (string-match-p regexp "")
- (throw 'found t)))
+ (throw 'found t))))
+ ;; This is bad, we should not be hard-coding for specific
+ ;; classes. Should just be composing the right kind of search
+ ;; criteria, then passing it on.
(`((,(and label (pred stringp)) . ,'ebdb-field-user-simple) ,(and regexp
(pred stringp)))
(dolist (f (ebdb-record-user-fields record))
(when (and (object-of-class-p f ebdb-field-user-simple)
(ebdb-field-search f (cons label regexp)))
(throw 'found t))))
- (`((,(and field-string (pred stringp)) . ,(and class (pred symbolp)))
,criterion) ; check one field
+ ;; Check one field.
+ (`((,(and field-string (pred stringp)) . ,(and class (pred symbolp)))
,criterion)
(dolist (f (ebdb-record-user-fields record))
(when (and (object-of-class-p f class)
(ebdb-field-search f criterion))
- [elpa] externals/ebdb ab1480b 078/350: Remove ebdb-this-buffer-name, (continued)
- [elpa] externals/ebdb ab1480b 078/350: Remove ebdb-this-buffer-name, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 1c4fadd 080/350: Make ebdb-record-name a get-or-get-and-set operation, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 9aab682 088/350: Add a generic for ebdb-db-editable, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 4263d5b 090/350: Fix the reload process, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb dd4f251 098/350: Split off ebdb-record-field for field classes, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 8c20202 103/350: Update company-ebdb to work with new search style, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5ec40d5 102/350: Add sections on searching and record marking to manual, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 7da77f4 089/350: Expand ebdb-with-record-edits, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 8312ea4 109/350: Allow company-ebdb to work in notmuch-message-mode as well, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb dcb7dbc 104/350: Change default keybindings in Gnus, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 9ac0f0f 111/350: Searching on empty strings should happen in field-search method,
Eric Abrahamsen <=
- [elpa] externals/ebdb c43e39b 097/350: Another round of compiler-inspired fixes, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 40df5bc 114/350: Remove ebdb-new-mails-primary, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 825c4cc 112/350: Simplify the structure of ebdb-org-hashtable, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb c0979b0 135/350: Typo in ebdb-mua-check-header, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 1219b93 100/350: Rework *EBDB* buffer searching, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 80ef19d 108/350: Make ebdb-search-read and ebdb-search-field into generics, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 6c85728 116/350: Manual and README additions, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 4688493 125/350: Wrap ebdb-parse in save-match-data, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 587ebbc 129/350: Use ebdb-prompt-for-record in org link completion, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 8f82b0f 121/350: Complete changes from ed3e270, Eric Abrahamsen, 2017/08/14