From 67ea98e36ec61cee05a3465b0af4cc992eaf851f Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 17 Jun 2024 22:00:03 +0300 Subject: [PATCH] mu4e-draft: fix mu4e-compose-pre-hook Run the hook earlier, and ensure mu4e-compose-type & mu4e-compose-parent-message are set. As noted in #2715. --- mu4e/mu4e-draft.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mu4e/mu4e-draft.el b/mu4e/mu4e-draft.el index 12834580c..ed867a906 100644 --- a/mu4e/mu4e-draft.el +++ b/mu4e/mu4e-draft.el @@ -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." @@ -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