Skip to content

Commit

Permalink
mu4e-draft: fix mu4e-compose-pre-hook
Browse files Browse the repository at this point in the history
Run the hook earlier, and ensure mu4e-compose-type &
mu4e-compose-parent-message are set.

As noted in #2715.
  • Loading branch information
djcb committed Jun 17, 2024
1 parent e6fd83d commit 67ea98e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mu4e/mu4e-draft.el
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,7 @@ This is mu4e's version of `message-hidden-headers'.")
"Get ready for message composition.
PARENT is the parent message, if any."
(unless (mu4e-running-p) (mu4e 'background)) ;; start if needed
(mu4e--context-autoswitch parent mu4e-compose-context-policy)
(run-hooks 'mu4e-compose-pre-hook))
(mu4e--context-autoswitch parent mu4e-compose-context-policy))

(defun mu4e--prepare-draft-headers (compose-type)
"Add extra headers for message based on COMPOSE-TYPE."
Expand Down Expand Up @@ -709,6 +708,11 @@ it must be nil.
After this, user is presented with a message composition buffer.
Returns the new buffer."
;; run pre-hook early, so user can influence later steps.
(let ((mu4e-compose-parent-message parent)
(mu4e-compose-type compose-type))
(run-hooks 'mu4e-compose-pre-hook))

(mu4e--prepare-draft parent)
;; evaluate BODY; this must yield a hidden, live buffer. This is evaluated in
;; a temp buffer with contains the parent-message, if any. if there's a
Expand Down

0 comments on commit 67ea98e

Please sign in to comment.