Skip to content

Commit

Permalink
Merge pull request #1 from titaniumbones/org-mu4e-compose-stabilization
Browse files Browse the repository at this point in the history
Org mu4e compose stabilization
  • Loading branch information
falloutphil committed May 16, 2018
2 parents b952724 + f3a9209 commit 0c2fac0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion mu4e/mu4e-compose.el
Expand Up @@ -213,6 +213,20 @@ place to do that."
:type 'hook
:group 'mu4e-compose)


(defcustom mu4e-compose-post-hook nil
"Hook run *after* message composition buffer is set up.
If the compose-type is either 'reply' or 'forward', the variable
`mu4e-compose-parent-message' points to the message replied to /
being forwarded / edited, and `mu4e-compose-type' contains the
type of message to be composed.
Use this as a replacement for `mu4e-compose-mode-hook' when you need
to avoid recursive loops e.g. with `org-mu4e-compose-org-mode'."
:type 'hook
:group 'mu4e-compose)


(defvar mu4e-compose-type nil
"The compose-type for this buffer, which is a symbol, `new',
`forward', `reply' or `edit'.")
Expand Down Expand Up @@ -649,7 +663,11 @@ tempfile)."
(mu4e~compose-hide-headers)
;; switch on the mode
(mu4e-compose-mode)

;; run mu4e-compose-post-hook -- having this here
;; allows org-mu4e-compose-org-mode and any
;; eventual replacement to run once on buffer creation
;; but not every time mode gets switched
(run-hooks 'mu4e-compose-post-hook)
;; set mu4e-compose-type once more for this buffer,
;; we loose it after the mode-change, it seems
(set (make-local-variable 'mu4e-compose-type) compose-type)
Expand Down
2 changes: 1 addition & 1 deletion mu4e/org-mu4e.el
Expand Up @@ -318,9 +318,9 @@ body using org-mode."
"org-mu4e-compose-org-mode enabled; "
"press M-m before issuing message-mode commands")))
(progn ;; otherwise, remove crap
(mu4e-compose-mode)
(remove-hook 'post-command-hook 'org~mu4e-mime-switch-headers-or-body t)
(org~mu4e-mime-undecorate-headers) ;; shut off org-mode stuff
(mu4e-compose-mode)
(message "org-mu4e-compose-org-mode disabled"))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down

0 comments on commit 0c2fac0

Please sign in to comment.