From da302e1cbaaab89b2bbb32c0f59e1aa6ee708455 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Wed, 19 Jan 2022 23:22:07 -0400 Subject: [PATCH] emacs: use cached encoded copy for fcc This fixes the bug reported by dkg in [1]. The movement of the call to n-m-setup-message-for-saving is so the cleanup of Fcc headers happens in the encoded version (otherwise Fcc headers may be saved to disk). [1]: id:87k1zm225v.fsf@fifthhorseman.net --- emacs/notmuch-maildir-fcc.el | 8 ++++++-- test/T350-crypto.sh | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index 7e177bf7..51020788 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -149,6 +149,7 @@ Otherwise set it according to `notmuch-fcc-dirs'." (buf (current-buffer)) (mml-externalize-attachments message-fcc-externalize-attachments)) (with-current-buffer (get-buffer-create " *message temp*") + (message-clone-locals buf) ;; for message-encoded-mail-cache (erase-buffer) (insert-buffer-substring buf) ,@body))) @@ -158,7 +159,10 @@ Otherwise set it according to `notmuch-fcc-dirs'." This should be called on a temporary copy. This is taken from the function message-do-fcc." - (message-encode-message-body) + (if (not message-encoded-mail-cache) + (message-encode-message-body) + (erase-buffer) + (insert message-encoded-mail-cache)) (save-restriction (message-narrow-to-headers) (mail-encode-encoded-word-buffer)) @@ -179,12 +183,12 @@ This is a rearranged version of message mode's message-do-fcc." (setq file (message-fetch-field "fcc" t))) (when file (with-temporary-notmuch-message-buffer + (notmuch-maildir-setup-message-for-saving) (save-restriction (message-narrow-to-headers) (while (setq file (message-fetch-field "fcc" t)) (push file files) (message-remove-header "fcc" nil t))) - (notmuch-maildir-setup-message-for-saving) ;; Process FCC operations. (mapc #'notmuch-fcc-handler files) (kill-buffer (current-buffer))))))) diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh index 209b8a74..3c6626b4 100755 --- a/test/T350-crypto.sh +++ b/test/T350-crypto.sh @@ -21,7 +21,6 @@ test_expect_success \ "(mml-secure-message-sign)"' test_begin_subtest "emacs delivery of signed message via fcc and smtp" -test_subtest_known_broken emacs_deliver_message \ 'signed message sent via SMTP' \ 'This is a test that messages are sent via SMTP' \ -- 2.45.2