[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb d0d0bbb 233/350: Shift transformation of search st
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb d0d0bbb 233/350: Shift transformation of search strings into ebdb-search |
Date: |
Mon, 14 Aug 2017 11:46:44 -0400 (EDT) |
branch: externals/ebdb
commit d0d0bbbb51a91b8b4f7b1acc98b301a71f06a013
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Shift transformation of search strings into ebdb-search
Fixes #39
* ebdb.el (ebdb-search-read): This originally happened in an :around
method on `ebdb-search-read'. There was no reason to limit
transformation to interactive input of search strings, though.
(ebdb-search): Instead, move it into the more fundamental
`ebdb-search', where it will affect all searches.
---
ebdb.el | 52 +++++++++++++++++++++++++---------------------------
1 file changed, 25 insertions(+), 27 deletions(-)
diff --git a/ebdb.el b/ebdb.el
index 108f6ab..f4cc587 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -4821,23 +4821,31 @@ criteria), which will be used to make a call to
`ebdb-record-search', or it is a callable, which will be called
with a record as the argument. All other values will be
interpreted as t, ie the record passes."
- (let ((case-fold-search ebdb-case-fold-search))
- (seq-filter
- (lambda (r)
- (eql (null invert)
- (catch 'found
- (condition-case nil
- (dolist (c clauses)
- (pcase c
- (`(,type ,criteria)
- (and (ebdb-record-search r type criteria)
- (throw 'found t)))
- (`,(and func (pred functionp))
- (and (funcall func r)
- (throw 'found t)))
- (_ t)))
- (cl-no-applicable-method nil)))))
- records)))
+ (let ((case-fold-search ebdb-case-fold-search)
+ criterion)
+ ;; Handle transformations of search strings.
+ (when ebdb-search-transform-functions
+ (dolist (c clauses)
+ (when (and (consp c)
+ (stringp (cadr c)))
+ (dolist (func ebdb-search-transform-functions)
+ (setf (cadr c) (funcall func (cadr c))))))
+ (seq-filter
+ (lambda (r)
+ (eql (null invert)
+ (catch 'found
+ (condition-case nil
+ (dolist (c clauses)
+ (pcase c
+ (`(,type ,criteria)
+ (and (ebdb-record-search r type criteria)
+ (throw 'found t)))
+ (`,(and func (pred functionp))
+ (and (funcall func r)
+ (throw 'found t)))
+ (_ t)))
+ (cl-no-applicable-method nil)))))
+ records))))
(cl-defgeneric ebdb-field-search (field criterion)
"Return t if search CRITERION somehow matches the value of
@@ -4966,16 +4974,6 @@ values, by default the search is not handed to the name
field itself."
In most cases this is a simple regexp, but field classes can
prompt users for more complex search criteria, if necessary.")
-(cl-defmethod ebdb-search-read :around (_key)
- "Give the functions in `ebdb-search-transform-functions' a
-chance to transform the search string."
- (let ((criterion (cl-call-next-method)))
- (if (and ebdb-search-transform-functions
- (stringp criterion))
- (dolist (f ebdb-search-transform-functions criterion)
- (setq criterion (funcall f criterion)))
- criterion)))
-
(cl-defmethod ebdb-search-read ((cls (subclass ebdb-field)))
(read-string (format "Search records with %s %smatching regexp: "
(ebdb-field-readable-name cls)
- [elpa] externals/ebdb bfc5d9d 208/350: Internationalized ebdb-parse method for names must accept slots arg, (continued)
- [elpa] externals/ebdb bfc5d9d 208/350: Internationalized ebdb-parse method for names must accept slots arg, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 0c2056c 209/350: Basic tests for EBDB's internationalization support, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 2bfb04e 220/350: Move ebdb-message-search to ebdb.el, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 40d71b9 222/350: Steal UUID generating function from Org, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 4937cbd 225/350: Specify class of name fields when updating from MUA, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 13c0a38 216/350: Tweaks to testing macros, more tests, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 2b28f57 239/350: Bump to version 0.2, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ff3cfa4 232/350: ebdb-parse-i18n for Chinese phones should pass class arg through, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb d5bec83 229/350: Fix to UUID change, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 72aba6a 228/350: New label/field alist for vcard export, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb d0d0bbb 233/350: Shift transformation of search strings into ebdb-search,
Eric Abrahamsen <=
- [elpa] externals/ebdb dc4217d 213/350: Compiler-inspired fixes, volume 5453, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ce5d9ee 242/350: Fix vCard formatting for anniversaries, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5d7a58c 246/350: Add option for character fold searching, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e5696fa 253/350: Add counsel-ebdb.el, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb fb4d5d5 255/350: Migration should guard against unparseable emails, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb aa15250 252/350: Change newline approach in vCard handling, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 0120729 240/350: Add vcard unescaping, and some vcard tests, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 6f8d59b 254/350: Fix record citation, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 3106b45 256/350: Require ebdb-format in ebdb-vcard, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 7549366 259/350: New method: ebdb-db-load-records, Eric Abrahamsen, 2017/08/14