[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 606d49a 6/8: Fix logic of singleton fields
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 606d49a 6/8: Fix logic of singleton fields |
Date: |
Mon, 6 Jan 2020 14:39:42 -0500 (EST) |
branch: externals/ebdb
commit 606d49a215622ee337e73d3177a0f23bc1a25508
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Fix logic of singleton fields
* ebdb.el (ebdb-record-insert-field): When we retrieve the "existing"
field, we actually get a list of fields.
---
ebdb.el | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/ebdb.el b/ebdb.el
index a2b09d6..efd6561 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -2898,12 +2898,16 @@ by the field, or else raising the error
`ebdb-related-unfound'.")
&optional _slot)
"Prevent RECORD from having more than one instance of FIELD."
(let ((existing (ebdb-record-field record (eieio-object-class field))))
+ ;; Using a class name with `ebdb-record-field' always returns a
+ ;; list.
(when existing
- (ebdb-record-delete-field record existing))
+ (dolist (f existing)
+ (ebdb-record-delete-field record f)))
(condition-case nil
(cl-call-next-method)
- ;; Put the old one back if something goes wrong.
- (error (ebdb-record-insert-field record existing)))))
+ ;; Put the old one back if something goes wrong. There should
+ ;; only be one field instance, so we blindly use `car'.
+ (error (ebdb-record-insert-field record (car existing))))))
(cl-defmethod ebdb-field-image-get ((field ebdb-field-image) (record
ebdb-record))
"Return the image for image field FIELD.
- [elpa] externals/ebdb updated (4fb5fc9 -> 50c8ee4), Eric Abrahamsen, 2020/01/06
- [elpa] externals/ebdb 8b952a4 2/8: First draft of EBDB support for Notmuch, Eric Abrahamsen, 2020/01/06
- [elpa] externals/ebdb 0f062bc 1/8: Simplify use of structs in migration, Eric Abrahamsen, 2020/01/06
- [elpa] externals/ebdb 04c207d 7/8: Shift location of auto update hook for wl, Eric Abrahamsen, 2020/01/06
- [elpa] externals/ebdb e169e58 4/8: Add guards against fields failing to produce strings, Eric Abrahamsen, 2020/01/06
- [elpa] externals/ebdb c0e7c2d 5/8: Neglected to add a ebdb-read method for ebdb-field-tags, Eric Abrahamsen, 2020/01/06
- [elpa] externals/ebdb 311775a 3/8: Bump copyright years to 2020, Eric Abrahamsen, 2020/01/06
- [elpa] externals/ebdb 50c8ee4 8/8: Bump to version 0.6.12, Eric Abrahamsen, 2020/01/06
- [elpa] externals/ebdb 606d49a 6/8: Fix logic of singleton fields,
Eric Abrahamsen <=