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

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

[elpa] externals/ebdb 2bfb04e 220/350: Move ebdb-message-search to ebdb.


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 2bfb04e 220/350: Move ebdb-message-search to ebdb.el
Date: Mon, 14 Aug 2017 11:46:41 -0400 (EDT)

branch: externals/ebdb
commit 2bfb04efe0bed15cb59494c80e9a96fa6c286cdb
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    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.
 



reply via email to

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