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

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

[elpa] externals/ebdb 118f567 062/350: Add a "defunct" arg to ebdb-recor


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 118f567 062/350: Add a "defunct" arg to ebdb-record-mail
Date: Mon, 14 Aug 2017 11:46:03 -0400 (EDT)

branch: externals/ebdb
commit 118f567d221f2fd10b406c8fc7241be6892dd16a
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

     Add a "defunct" arg to ebdb-record-mail
    
     * ebdb.el (ebdb-record-mail): Controlling whether we return defunct
       mail addresses or not.
       (ebdb-record-search): When searching mails, also search defunct
       mails.
---
 ebdb.el | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/ebdb.el b/ebdb.el
index 759024a..a226368 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -2153,7 +2153,7 @@ priority."
 (cl-defmethod ebdb-record-search ((record ebdb-record-entity)
                                  (_type (eql mail))
                                  (regexp string))
-  (let ((mails (ebdb-record-mail record t)))
+  (let ((mails (ebdb-record-mail record t nil t)))
     (if mails
        (catch 'found
          (dolist (m mails)
@@ -3310,13 +3310,25 @@ If RECORDS are given, only search those records."
        (object-assoc label 'object-name phones)
       phones)))
 
-(defun ebdb-record-mail (record &optional roles label)
+(defun ebdb-record-mail (record &optional roles label defunct)
+  "Return a list of all RECORD's mail fields.
+
+If ROLES is non-nil, also consider mail fields from RECORD's
+roles.  If LABEL is a string, return the mail with that label.
+If DEFUNCT is non-nil, also consider RECORD's defunct mail
+addresses."
   (let ((mails (slot-value record 'mail)))
     (when (and roles (slot-exists-p record 'organizations))
       (dolist (r (slot-value record 'organizations))
        (when (and (slot-value r 'mail)
-                  (null (slot-value r 'defunct)))
+                  (or defunct
+                      (null (slot-value r 'defunct))))
          (push (slot-value r 'mail) mails))))
+    (unless defunct
+      (setq mails
+           (seq-filter (lambda (m)
+                         (null (eq (slot-value m 'priority) 'defunct)))
+                       mails)))
     (if label
        (object-assoc label 'object-name mails)
       mails)))



reply via email to

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