From 9f476295e1f794e29fe1e3c4f7a349a8104936fc Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sat, 13 Apr 2024 20:07:53 +0300 Subject: [PATCH] mu4e-compose: rework message-sent-hook Grab the Fcc in the hook (when available). --- mu4e/mu4e-compose.el | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index a8e9fed2..f3d69815 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -548,26 +548,27 @@ appropriate flag at the message forwarded or replied-to." ;; removing the In-Reply-To header. (save-restriction (message-narrow-to-headers) - (let* ((fcc-path (message-fetch-field "Fcc"))) - (when (eq mu4e-compose-type 'reply) - (unless (message-fetch-field "In-Reply-To") - (message-remove-header "References"))) - (when use-hard-newlines - (mu4e--send-harden-newlines)) - ;; now handle what happens _after_ sending; typically, draft is gone and - ;; the sent message appears in sent. Update flags for related messages, - ;; i.e. for Forwarded ('Passed') and Replied messages, try to set the - ;; appropriate flag at the message forwarded or replied-to. - (add-hook 'message-sent-hook - (lambda () - (when fcc-path ;; hmmm... #2688 + (when (eq mu4e-compose-type 'reply) + (unless (message-fetch-field "In-Reply-To") + (message-remove-header "References"))) + (when use-hard-newlines + (mu4e--send-harden-newlines)) + ;; now handle what happens _after_ sending; typically, draft is gone and + ;; the sent message appears in sent. Update flags for related messages, + ;; i.e. for Forwarded ('Passed') and Replied messages, try to set the + ;; appropriate flag at the message forwarded or replied-to. + (add-hook 'message-sent-hook + (lambda () + (save-restriction + (message-narrow-to-headers) + (when-let ((fcc-path (message-fetch-field "Fcc"))) (mu4e--set-parent-flags fcc-path) ;; we end up with a ((buried) buffer here, visiting ;; the fcc-path; not quite sure why. But let's ;; get rid of it (#2681) (when-let ((buf (find-buffer-visiting fcc-path))) - (kill-buffer buf)))) - nil t)))) + (kill-buffer buf))))) + nil t))) ;;; Crypto (defun mu4e--compose-setup-crypto (parent compose-type)