[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb dd2f73c 10/15: Change behavior of mail insertion
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb dd2f73c 10/15: Change behavior of mail insertion |
Date: |
Sun, 1 Apr 2018 06:02:49 -0400 (EDT) |
branch: externals/ebdb
commit dd2f73cfb7e8c9b9fa5369c783e84530817c98ca
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Change behavior of mail insertion
* ebdb.el (ebdb-record-insert-field): Change what this method does. It
previously sorted all the record's mails, which is a no-no because
it was setting slot values directly, without going through the
database-aware accessors. Don't do that (we still don't have a good
way of doing that). Instead, do something else: set the priority the
mail, if the record has no other primary mail.
---
ebdb.el | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/ebdb.el b/ebdb.el
index e3042e1..613660b 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -3019,13 +3019,14 @@ If FIELD doesn't specify a year, use the current year."
(cl-defmethod ebdb-record-organizations ((_record ebdb-record-entity))
nil)
-(cl-defmethod ebdb-record-insert-field :after ((record ebdb-record-entity)
- (_mail ebdb-field-mail)
- &optional _slot)
- "After giving RECORD a new mail field, sort RECORD's mails by
-priority."
- (let ((sorted (ebdb-sort-mails (slot-value record 'mail))))
- (setf (slot-value record 'mail) sorted)))
+(cl-defmethod ebdb-record-insert-field :before ((record ebdb-record-entity)
+ (mail ebdb-field-mail)
+ &optional _slot)
+ "Possibly set the priority of a newly-added mail address.
+If RECORD has no other primary mail, set MAIL's priority to
+primary."
+ (when (null (object-assoc 'primary 'priority (ebdb-record-mail record)))
+ (setf (slot-value mail 'priority) 'primary)))
(defun ebdb-compose-mail (&rest args)
"Start composing a mail message to send.
- [elpa] externals/ebdb a25e1eb 06/15: Use values from "slots" in role field ebdb-read, (continued)
- [elpa] externals/ebdb a25e1eb 06/15: Use values from "slots" in role field ebdb-read, Eric Abrahamsen, 2018/04/01
- [elpa] externals/ebdb 9bd965b 02/15: Simplify ebdb-with-record-edits, Eric Abrahamsen, 2018/04/01
- [elpa] externals/ebdb 4bb77e3 11/15: Add mail deletion behavior, Eric Abrahamsen, 2018/04/01
- [elpa] externals/ebdb 27a1fa5 05/15: Move field manipulation "convenience logic" into ebdb-com, Eric Abrahamsen, 2018/04/01
- [elpa] externals/ebdb 70754b8 08/15: Fix unnecessary code in ebdb-follow-related, Eric Abrahamsen, 2018/04/01
- [elpa] externals/ebdb c3e06ee 12/15: Use quoted field class, Eric Abrahamsen, 2018/04/01
- [elpa] externals/ebdb a7e88d4 14/15: Update copyright dates, Eric Abrahamsen, 2018/04/01
- [elpa] externals/ebdb 7a5ce18 13/15: Handle mail priority after customization edits, Eric Abrahamsen, 2018/04/01
- [elpa] externals/ebdb d60338c 15/15: Bump version to 0.5, Eric Abrahamsen, 2018/04/01
- [elpa] externals/ebdb b323307 09/15: Add a "follow related" action to role fields, Eric Abrahamsen, 2018/04/01
- [elpa] externals/ebdb dd2f73c 10/15: Change behavior of mail insertion,
Eric Abrahamsen <=