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

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

[elpa] externals/ebdb b98ae3a: Don't offer to create contacts twice when


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb b98ae3a: Don't offer to create contacts twice when sending messages
Date: Mon, 23 Nov 2020 17:37:06 -0500 (EST)

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

    Don't offer to create contacts twice when sending messages
    
    * ebdb-message.el (ebdb-after-load-hook): We run
    `ebdb-message-auto-update' twice, in the message-header-setup-hook and
    when sending the message. If the user has ebdb-message-auto-update-p
    returning 'query or something equivalent, they could be prompted
    multiple times to create new records. Hard-code the first call to use
    'existing, so potential record creation only happens once, when the
    user is ready to send the message.
    (ebdb-message-display-only): Totally unnecessary extra function to do
    that. I just don't like lambdas in hooks.
---
 ebdb-message.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/ebdb-message.el b/ebdb-message.el
index 3e1fa3a..77c6466 100644
--- a/ebdb-message.el
+++ b/ebdb-message.el
@@ -162,6 +162,9 @@ Also fires when postponing a draft."
 (defun ebdb-message-auto-update ()
   (ebdb-mua-auto-update ebdb-message-auto-update-p))
 
+(defun ebdb-message-display-only ()
+  (ebdb-mua-auto-update 'existing))
+
 (add-hook 'message-mode-hook 'ebdb-insinuate-message)
 (add-hook 'mail-setup-hook 'ebdb-insinuate-mail)
 (add-hook 'message-send-hook 'ebdb-message-auto-update)
@@ -175,7 +178,9 @@ Also fires when postponing a draft."
 (add-hook 'ebdb-after-load-hook
          (lambda ()
            (with-eval-after-load "gnus-win"
-             (add-hook 'message-header-setup-hook 'ebdb-message-auto-update)
+             ;; Display only because we're going to be (possibly)
+             ;; prompted for creation again when the message is sent.
+             (add-hook 'message-header-setup-hook #'ebdb-message-display-only)
 
              (when ebdb-mua-pop-up
                (add-to-list 'gnus-window-to-buffer



reply via email to

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