summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modes/mu4e/evil-collection-mu4e.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/modes/mu4e/evil-collection-mu4e.el b/modes/mu4e/evil-collection-mu4e.el
index 756c171..8aba94d 100644
--- a/modes/mu4e/evil-collection-mu4e.el
+++ b/modes/mu4e/evil-collection-mu4e.el
@@ -89,6 +89,21 @@
(evil-set-initial-state mode 'normal))
(evil-set-initial-state 'mu4e-compose-mode 'insert))
+;; When using org-mu4e, the above leads to an annoying behaviour, because
+;; switching from message body to header activates mu4e-compose-mode, thus
+;; putting the user into insert-state. The below code fixes this issue.
+(defun evil-collection-mu4e-org-set-header-to-normal-mode ()
+ (evil-set-initial-state 'mu4e-compose-mode 'normal))
+
+(defun evil-collection-mu4e-org-set-header-to-insert-mode ()
+ (evil-set-initial-state 'mu4e-compose-mode 'insert))
+
+(add-hook 'org-mode-hook
+ #'evil-collection-mu4e-org-set-header-to-normal-mode)
+
+(add-hook 'mu4e-compose-pre-hook
+ #'evil-collection-mu4e-org-set-header-to-insert-mode)
+
;;; Define bindings