branch: externals/autocrypt
commit 82b9a9eaa2ef51e24e75afe6abc30089104b1530
Author: Philip K <[email protected]>
Commit: Philip K <[email protected]>

    Fix autocrypt-mu4e
---
 autocrypt-mu4e.el | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/autocrypt-mu4e.el b/autocrypt-mu4e.el
index 3dcda9d011..1ba88d5e23 100644
--- a/autocrypt-mu4e.el
+++ b/autocrypt-mu4e.el
@@ -22,14 +22,20 @@
 
 ;;; Code:
 
-(require 'mu4e)
+(declare-function mu4e-view-raw-message "mu4e" () )
 
 ;;; XXX: mu4e seems to share no common mode, and the `derived-mode'
 ;;;       specializer supports only one mode (currently). Therefore
 ;;;       the method definitions have to be duplicated.
 
+;;;###autoload
+(cl-defmethod autocrypt-load-system ((_mode (derived-mode mu4e-main-mode)))
+  "Load this module."
+  (require 'autocrypt-mu4e))
+
 (cl-defmethod autocrypt-install ((_mode (derived-mode mu4e-main-mode)))
   "Install autocrypt hooks for mu4e."
+  (require 'autocrypt-mu4e)
   (add-hook 'mu4e-view-mode-hook #'autocrypt-process-header)
   (add-hook 'mu4e-compose-mode-hook #'autocrypt-compose-setup))
 
@@ -43,9 +49,14 @@
   "Ask mu4e to return HEADER."
   (save-window-excursion
     (with-current-buffer (mu4e-view-raw-message)
-      (prog1 (mail-fetch-field field)
+      (prog1 (mail-fetch-field header)
         (kill-buffer (current-buffer))))))
 
+;;;###autoload
+(cl-defmethod autocrypt-load-system ((_mode (derived-mode mu4e-view-mode)))
+  "Load this module."
+  (require 'autocrypt-mu4e))
+
 ;;;###autoload
 (cl-defmethod autocrypt-install ((_mode (derived-mode mu4e-view-mode)))
   "Install autocrypt hooks for mu4e."

Reply via email to