branch: externals/ebdb
commit 44f8379883dd4daee86417047cf0df58d5a3039b
Author: Eric Abrahamsen <e...@ericabrahamsen.net>
Commit: Eric Abrahamsen <e...@ericabrahamsen.net>

    Add ebdb-load guards to all MUA insinuation functions
    
    Ensure EBDB is loaded when the MUA starts up.
---
 ebdb-gnus.el    | 2 ++
 ebdb-message.el | 4 ++++
 ebdb-mhe.el     | 2 ++
 ebdb-mu4e.el    | 2 ++
 ebdb-notmuch.el | 4 ++++
 ebdb-rmail.el   | 2 ++
 ebdb-vm.el      | 2 ++
 ebdb-wl.el      | 2 ++
 8 files changed, 20 insertions(+)

diff --git a/ebdb-gnus.el b/ebdb-gnus.el
index 58078e4836..7782d28b37 100644
--- a/ebdb-gnus.el
+++ b/ebdb-gnus.el
@@ -339,6 +339,8 @@ composed to a certain record."
 ;;;###autoload
 (defun ebdb-insinuate-gnus ()
   "Hook EBDB into Gnus."
+  (unless ebdb-db-list
+    (ebdb-load))
   ;; `ebdb-mua-display-sender' fails in *Article* buffers, where
   ;; `gnus-article-read-summary-keys' provides an additional wrapper
   ;; that restores the window configuration.
diff --git a/ebdb-message.el b/ebdb-message.el
index 3c9ddf01b1..a32ae4e63c 100644
--- a/ebdb-message.el
+++ b/ebdb-message.el
@@ -120,6 +120,8 @@ Also fires when postponing a draft."
 
 (defun ebdb-insinuate-message ()
   ;; We don't currently bind the `ebdb-mua-keymap'.
+  (unless ebdb-db-list
+    (ebdb-load))
   (pcase ebdb-complete-mail
     ('capf (progn (add-hook
                   'completion-at-point-functions
@@ -153,6 +155,8 @@ Also fires when postponing a draft."
 (defun ebdb-insinuate-mail ()
   "Hook EBDB into Mail Mode."
   ;; We don't currently bind the `ebdb-mua-keymap'.
+  (unless ebdb-db-list
+    (ebdb-load))
   (pcase ebdb-complete-mail
     ('capf (progn (add-hook
                   'completion-at-point-functions
diff --git a/ebdb-mhe.el b/ebdb-mhe.el
index 0849c4c34b..57268fb718 100644
--- a/ebdb-mhe.el
+++ b/ebdb-mhe.el
@@ -140,6 +140,8 @@ Returns the empty string if HEADER is not in the message."
 ;;;###autoload
 (defun ebdb-insinuate-mh ()
   "Hook EBDB into MH-E."
+  (unless ebdb-db-list
+    (ebdb-load))
   (define-key mh-folder-mode-map ";" ebdb-mua-keymap)
   (when ebdb-complete-mail
     (define-key mh-letter-mode-map "\M-;" 'ebdb-complete-mail)
diff --git a/ebdb-mu4e.el b/ebdb-mu4e.el
index efc5a3e29c..b907d1b9a5 100644
--- a/ebdb-mu4e.el
+++ b/ebdb-mu4e.el
@@ -71,6 +71,8 @@ the value of `ebdb-default-window-size'."
 (defun ebdb-insinuate-mu4e ()
   "Hook EBDB into mu4e."
   ;; Tackle headers later
+  (unless ebdb-db-list
+    (ebdb-load))
   (define-key mu4e-view-mode-map ";" ebdb-mua-keymap)
   (add-hook 'message-sent-hook
            (lambda ()
diff --git a/ebdb-notmuch.el b/ebdb-notmuch.el
index 78f6ca1ee6..74142a45cc 100644
--- a/ebdb-notmuch.el
+++ b/ebdb-notmuch.el
@@ -65,11 +65,15 @@ the value of `ebdb-default-window-size'."
 ;;;###autoload
 (defun ebdb-insinuate-notmuch-show ()
   "Hook EBDB into Notmuch's `notmuch-show-mode'."
+  (unless ebdb-db-list
+    (ebdb-load))
   (define-key notmuch-show-mode-map ";" ebdb-mua-keymap))
 
 ;;;###autoload
 (defun ebdb-insinuate-notmuch-message ()
   "Hook EBDB into Notmuch's `notmuch-message-mode'."
+  (unless ebdb-db-list
+    (ebdb-load))
   (when ebdb-complete-mail
     (define-key notmuch-message-mode-map (kbd "TAB") #'ebdb-complete-mail)))
 
diff --git a/ebdb-rmail.el b/ebdb-rmail.el
index c7d940169f..b86d12cb15 100644
--- a/ebdb-rmail.el
+++ b/ebdb-rmail.el
@@ -82,6 +82,8 @@ the value of `ebdb-default-window-size'."
 ;;;###autoload
 (defun ebdb-insinuate-rmail ()
   "Hook EBDB into RMAIL."
+  (unless ebdb-db-list
+    (ebdb-load))
   (define-key rmail-mode-map ";" ebdb-mua-keymap))
 
 ;;;###autoload
diff --git a/ebdb-vm.el b/ebdb-vm.el
index cf6c54a51d..0190bdd51d 100644
--- a/ebdb-vm.el
+++ b/ebdb-vm.el
@@ -369,6 +369,8 @@ from different senders."
 ;;;###autoload
 (defun ebdb-insinuate-vm ()
   "Hook EBDB into VM."
+  (unless ebdb-db-list
+    (ebdb-load))
   (define-key vm-mode-map ";" ebdb-mua-keymap)
   (define-key vm-mode-map "/" 'ebdb)
   ;; `mail-mode-map' is the parent of `vm-mail-mode-map'.
diff --git a/ebdb-wl.el b/ebdb-wl.el
index 5902d66736..db1e084010 100644
--- a/ebdb-wl.el
+++ b/ebdb-wl.el
@@ -137,6 +137,8 @@ beginning) of the signature separator."
 ;;;###autoload
 (defun ebdb-insinuate-wl ()
   "Hook EBDB into Wanderlust."
+  (unless ebdb-db-list
+    (ebdb-load))
   (define-key wl-summary-mode-map ";" ebdb-mua-keymap)
   (define-key mime-view-mode-default-map ";" ebdb-mua-keymap)
   (when ebdb-complete-mail

Reply via email to