[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 7549366 259/350: New method: ebdb-db-load-records
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 7549366 259/350: New method: ebdb-db-load-records |
Date: |
Mon, 14 Aug 2017 11:46:49 -0400 (EDT) |
branch: externals/ebdb
commit 75493668f6667fe1838540e9065f5c9a9bdb13e6
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
New method: ebdb-db-load-records
* ebdb.el (ebdb-db-load-records): Separate out the ebdb-db-load and
ebdb-db-load-records processes, so that we can call
ebdb-db-load-records separately, even after db is loaded.
(ebdb-db-add-record): This method now uses ebdb-db-load-records on
newly-added records. This allows our uuid checking and merging
process to kick in when adding records, not only when loading the
database.
---
ebdb.el | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/ebdb.el b/ebdb.el
index 48bfc4f..458ab11 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -2940,9 +2940,21 @@ overwrite data somewhere."
(ebdb-dirty-records (slot-value db 'records))))
(cl-defmethod ebdb-db-load ((db ebdb-db))
- "Complete the loading procedure for DB."
- ;; By this point, all the DB's records are in its record slot.
- (dolist (rec (slot-value db 'records) t)
+ ;; By this stage, all of DB's records should be in the 'records
+ ;; slot. This happens automatically with `ebdb-db-file'; other
+ ;; subclasses should overload this method to load their records.
+ (ebdb-db-load-records db (slot-value db 'records)))
+
+(cl-defgeneric ebdb-db-load-records (db records)
+ "Load RECORDS into DB.
+
+This method is responsible for adding DB to records' caches,
+checking their uuid, and hashing the uuid. It happens at two
+different points: after loading DB, and when adding a record to
+DB.")
+
+(cl-defmethod ebdb-db-load-records ((db ebdb-db) records)
+ (dolist (rec records t)
;; Cycle over each loaded record.
(condition-case err
@@ -3125,13 +3137,12 @@ the persistent save, or allow them to propagate."
(setf (slot-value record 'uuid)
(make-instance
'ebdb-field-uuid
- :uuid (ebdb-make-uuid (slot-value db 'uuid-prefix))))
- (ebdb-puthash (ebdb-record-uuid record) record))
+ :uuid (ebdb-make-uuid (slot-value db 'uuid-prefix)))))
(object-add-to-list db 'records record)
+ (ebdb-db-load-records db (list record))
+ (setf (slot-value db 'dirty) t)
;; TODO: Is there any need to sort the DB's records after insertion?
;; What about sorting ebdb-record-tracker?
- (object-add-to-list (ebdb-record-cache record)
- 'database db)
record)
(cl-defmethod ebdb-db-remove-record ((db ebdb-db) record)
- [elpa] externals/ebdb d0d0bbb 233/350: Shift transformation of search strings into ebdb-search, (continued)
- [elpa] externals/ebdb d0d0bbb 233/350: Shift transformation of search strings into ebdb-search, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb dc4217d 213/350: Compiler-inspired fixes, volume 5453, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb ce5d9ee 242/350: Fix vCard formatting for anniversaries, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5d7a58c 246/350: Add option for character fold searching, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e5696fa 253/350: Add counsel-ebdb.el, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb fb4d5d5 255/350: Migration should guard against unparseable emails, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb aa15250 252/350: Change newline approach in vCard handling, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 0120729 240/350: Add vcard unescaping, and some vcard tests, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 6f8d59b 254/350: Fix record citation, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 3106b45 256/350: Require ebdb-format in ebdb-vcard, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 7549366 259/350: New method: ebdb-db-load-records,
Eric Abrahamsen <=
- [elpa] externals/ebdb b37356a 270/350: Fix docstring of ebdb-create-record, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 5135645 260/350: Split out ebdb-notice-record and ebdb-notice-field methods, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 71a93f5 268/350: Put a load protection in ebdb-mua-update-records, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb cacb97b 271/350: Fix bug in MUA record creation, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb e5bdee2 278/350: Rework ebdb-mail-yank, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 8dd1600 273/350: Change type of anniversary field dates, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 57b2514 276/350: Use ebdb-with-record-edits in more places, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb f44a797 286/350: New function ebdb-mua-in-ebdb-buffer, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 4ce353e 237/350: Migrate more search routines to the ebdb-search-display thing, Eric Abrahamsen, 2017/08/14
- [elpa] externals/ebdb 7040cad 247/350: Expand ebdb-helm to complete on mails as well, Eric Abrahamsen, 2017/08/14