branch: externals/ebdb
commit 2bfb04efe0bed15cb59494c80e9a96fa6c286cdb
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
Move ebdb-message-search to ebdb.el
* ebdb-com.el: It shouldn't be in here.
* ebdb.el: Move it here.
---
ebdb-com.el | 29 -----------------------------
ebdb.el | 29 +++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/ebdb-com.el b/ebdb-com.el
index 3b6041b..20d9515 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -1501,35 +1501,6 @@ DATE must be in yyyy-mm-dd format."
"Used for parsing phone numbers."
(string-to-number (match-string num string)))
-(defun ebdb-message-search (name mail)
- "Return list of EBDB records matching NAME and/or MAIL.
-First try to find a record matching both NAME and MAIL.
-If this fails try to find a record matching MAIL.
-If this fails try to find a record matching NAME.
-NAME may match FIRST_LAST, LAST_FIRST or AKA.
-
-This function performs a fast search using `ebdb-hashtable'.
-NAME and MAIL must be strings or nil.
-See `ebdb-search' for searching records with regexps."
- (when (or name mail)
- (unless ebdb-db-list
- (ebdb-load))
- (let ((mrecords (if mail (ebdb-gethash mail '(mail))))
- (nrecords (if name (ebdb-gethash name '(fl-name lf-name aka)))))
- ;; (1) records matching NAME and MAIL
- (or (and mrecords nrecords
- (let (records)
- (dolist (record nrecords)
- (mapc (lambda (mr) (if (and (eq record mr)
- (not (memq record records)))
- (push record records)))
- mrecords))
- records))
- ;; (2) records matching MAIL
- mrecords
- ;; (3) records matching NAME
- nrecords))))
-
(defmacro ebdb-with-record-edits (spec &rest body)
"Run BODY on all records listed in the cdr of SPEC.
diff --git a/ebdb.el b/ebdb.el
index 0a309d3..4b34d0e 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -4756,6 +4756,35 @@ With prefix ARG, insert string at point."
;;; Searching EBDB
+(defun ebdb-message-search (name mail)
+ "Return list of EBDB records matching NAME and/or MAIL.
+First try to find a record matching both NAME and MAIL.
+If this fails try to find a record matching MAIL.
+If this fails try to find a record matching NAME.
+NAME may match FIRST_LAST, LAST_FIRST or AKA.
+
+This function performs a fast search using `ebdb-hashtable'.
+NAME and MAIL must be strings or nil.
+See `ebdb-search' for searching records with regexps."
+ (when (or name mail)
+ (unless ebdb-db-list
+ (ebdb-load))
+ (let ((mrecords (if mail (ebdb-gethash mail '(mail))))
+ (nrecords (if name (ebdb-gethash name '(fl-name lf-name aka)))))
+ ;; (1) records matching NAME and MAIL
+ (or (and mrecords nrecords
+ (let (records)
+ (dolist (record nrecords)
+ (mapc (lambda (mr) (if (and (eq record mr)
+ (not (memq record records)))
+ (push record records)))
+ mrecords))
+ records))
+ ;; (2) records matching MAIL
+ mrecords
+ ;; (3) records matching NAME
+ nrecords))))
+
(defun ebdb-search (records clauses &optional invert)
"Search RECORDS for records matching CLAUSES.