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

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

[elpa] externals/ebdb f63ca3f 2/2: Change order of create/change hooks i


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb f63ca3f 2/2: Change order of create/change hooks in record creation
Date: Sat, 21 Nov 2020 21:52:53 -0500 (EST)

branch: externals/ebdb
commit f63ca3f8421c878bce5911a8145ec6dd6ee92d29
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    Change order of create/change hooks in record creation
    
    * ebdb-mua.el (ebdb-annotate-message): The create and change hooks are
    very likely to edit the records, and we need the record to have been
    added to a database before that happens.
    * ebdb-com.el (ebdb-create-record): Same here.
---
 ebdb-com.el | 2 +-
 ebdb-mua.el | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/ebdb-com.el b/ebdb-com.el
index 435b8cd..657c192 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -1733,9 +1733,9 @@ for these values."
       (let (record)
        (ebdb-db-editable db nil t)
        (setq record (ebdb-read record-class))
+       (ebdb-db-add-record db record)
        (run-hook-with-args 'ebdb-create-hook record)
        (run-hook-with-args 'ebdb-change-hook record)
-       (ebdb-db-add-record db record)
        (ebdb-init-record record)
        (run-hook-with-args 'ebdb-after-change-hook record)
        (ebdb-display-records (list record) ebdb-default-multiline-formatter t)
diff --git a/ebdb-mua.el b/ebdb-mua.el
index 48e6a81..1c7ab91 100644
--- a/ebdb-mua.el
+++ b/ebdb-mua.el
@@ -967,9 +967,9 @@ Return the records matching ADDRESS or nil."
                                         (or name mail)))))
           (setq records (list (make-instance record-class))
                 created-p t)
+         (ebdb-db-add-record (ebdb-prompt-for-db nil t) (car records))
          (run-hook-with-args 'ebdb-create-hook (car records))
-         (run-hook-with-args 'ebdb-change-hook (car records))
-         (ebdb-db-add-record (ebdb-prompt-for-db nil t) (car records))))
+         (run-hook-with-args 'ebdb-change-hook (car records))))
 
       (dolist (record records)
        (let* ((old-name (ebdb-record-name-string record))
@@ -1075,9 +1075,10 @@ Return the records matching ADDRESS or nil."
                                             (ebdb-string record)))))
                           (progn
                             (setq record (make-instance 
ebdb-default-record-class))
+                           (ebdb-db-add-record (ebdb-prompt-for-db nil t) 
record)
                            (run-hook-with-args 'ebdb-create-hook record)
                            (run-hook-with-args 'ebdb-change-hook record)
-                           (ebdb-db-add-record (ebdb-prompt-for-db nil t) 
record)
+
                             (ebdb-record-change-name record name)
                             (setq created-p t))))
 



reply via email to

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