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

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

[elpa] externals/ebdb 7d41fb9 076/350: Small tweaks to ebdb-load


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 7d41fb9 076/350: Small tweaks to ebdb-load
Date: Mon, 14 Aug 2017 11:46:06 -0400 (EDT)

branch: externals/ebdb
commit 7d41fb9226551b9c987b79705a75cc492c466cca
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Small tweaks to ebdb-load
    
    * ebdb.el (ebdb-load): Accept actual ebdb-db instances in the
      ebdb-sources list, and make some other small changes.
---
 ebdb.el | 44 +++++++++++++++++++++++---------------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/ebdb.el b/ebdb.el
index 64124c5..cceccb7 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -4357,25 +4357,26 @@ important work is done by the `ebdb-db-load' method."
     (ebdb-clear-vars)
     (run-hooks 'ebdb-before-load-hook)
     (dolist (s sources)
-      (if (stringp s)
-         (if (file-exists-p s)
-             ;; Handle auto-saved databases.
-             (let ((auto-save-file (ebdb-db-make-auto-save-file-name s))
-                   (orig-filename s))
-               (if (and (file-exists-p auto-save-file)
-                        (yes-or-no-p (format "Recover auto-save file for %s? " 
s)))
-                   (progn (setq s (eieio-persistent-read auto-save-file 
'ebdb-db t))
-                          (setf (slot-value s 'file) orig-filename)
-                          (setf (slot-value s 'dirty) t))
-                 (setq s (eieio-persistent-read s 'ebdb-db t))))
-           ;; Handle new/nonexistent databases.
-           (when (yes-or-no-p (format "%s does not exist, create? " s))
-             (setq s (make-instance 'ebdb-db-file :file s :dirty t))
-             ;; Try to get it on disk first.
-             (ebdb-db-save s)))
-       (error "Source %s should be a filename." s))
+      (cond ((stringp s)
+             (if (file-exists-p s)
+                 ;; Handle auto-saved databases.
+                 (let ((auto-save-file (ebdb-db-make-auto-save-file-name s))
+                       (orig-filename s))
+                   (if (and (file-exists-p auto-save-file)
+                            (yes-or-no-p (format "Recover auto-save file for 
%s? " s)))
+                       (progn (setq s (eieio-persistent-read auto-save-file 
'ebdb-db t))
+                              (setf (slot-value s 'file) orig-filename)
+                              (setf (slot-value s 'dirty) t))
+                     (setq s (eieio-persistent-read s 'ebdb-db t))))
+               ;; Handle new/nonexistent databases.
+               (when (yes-or-no-p (format "%s does not exist, create? " s))
+                 (setq s (make-instance 'ebdb-db-file :file s :dirty t))
+                 ;; Try to get it on disk first.
+                 (ebdb-db-save s))))
+           ((null (object-of-class-p s ebdb-db))
+            (error "Source %s must be a filename or instance of `ebdb-db'." 
s)))
       ;; Now load it.
-      (if (child-of-class-p (eieio-object-class s) 'ebdb-db)
+      (if (object-of-class-p s 'ebdb-db)
          (if (null (slot-value s 'disabled))
              (ebdb-db-load s)
            (message "Database %s is currently disabled." s)
@@ -4385,10 +4386,11 @@ important work is done by the `ebdb-db-load' method."
         (null ebdb-record-tracker)
         (bound-and-true-p bbdb-file)
         (file-exists-p bbdb-file))
-       ;; We're migrating from a previous version of EBDB.
-       (ebdb-migrate-from-bbdb)
-      (message "Loading EBDB sources... done"))
+       ;; We're migrating from a version of BBDB.
+       (ebdb-migrate-from-bbdb))
+    (message "Initializing EBDB records...")
     (ebdb-initialize)
+    (message "Initializing EBDB records... done")
     ;; Users will expect the same ordering as `ebdb-sources'
     (setq ebdb-db-list (nreverse ebdb-db-list))
     (run-hooks 'ebdb-after-load-hook)



reply via email to

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