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

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

[elpa] externals/ebdb 4027218 3/6: Have ebdb-record-mail sort mails by p


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 4027218 3/6: Have ebdb-record-mail sort mails by priority
Date: Tue, 19 May 2020 15:49:20 -0400 (EDT)

branch: externals/ebdb
commit 4027218c7a47f96b23212d302dd084e58fa9ab06
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Have ebdb-record-mail sort mails by priority
    
    Fixes #87
    
    * ebdb.el (ebdb-record-mail): Primary mails first.
---
 ebdb.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ebdb.el b/ebdb.el
index 25eff4b..6788310 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -4484,7 +4484,7 @@ If RECORDS are given, only search those records."
 If NO-ROLES is non-nil, exclude 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."
+addresses.  Sort mails by descending priority."
   (let ((mails (slot-value record 'mail)))
     (when (and (null no-roles) (slot-exists-p record 'organizations))
       (dolist (r (slot-value record 'organizations))
@@ -4499,7 +4499,10 @@ addresses."
                        mails)))
     (if label
        (object-assoc label 'label mails)
-      mails)))
+      (sort mails (lambda (m1 m2)
+                   (or (eql (slot-value m1 'priority) 'primary)
+                       (and (eql (slot-value m1 'priority) 'normal)
+                            (eql (slot-value m2 'priority) 'defunct))))))))
 
 
 



reply via email to

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