unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 4/4] emacs: use cached encoded copy for fcc
Date: Thu, 20 Jan 2022 08:33:54 -0400	[thread overview]
Message-ID: <20220120123354.3999579-5-david@tethera.net> (raw)
In-Reply-To: <20220120123354.3999579-1-david@tethera.net>

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.34.1

  parent reply	other threads:[~2022-01-20 12:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 12:33 fix Fcc of signed / encrypted messages David Bremner
2022-01-20 12:33 ` [PATCH 1/4] test/emacs: match mml settings in emacs_{fcc,deliver}_message David Bremner
2022-01-20 12:33 ` [PATCH 2/4] test: define test_expect_equal_message_body David Bremner
2022-01-20 22:16   ` Tomi Ollila
2022-01-22  2:56     ` David Bremner
2022-01-20 12:33 ` [PATCH 3/4] test/emacs: known broken test for matching fcc and sent message David Bremner
2022-01-20 12:33 ` David Bremner [this message]
2022-01-26 11:38 ` fix Fcc of signed / encrypted messages David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220120123354.3999579-5-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).