From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id EMw4O1tqAGbH+gAA62LTzQ:P1 (envelope-from ) for ; Sun, 24 Mar 2024 19:01:00 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id EMw4O1tqAGbH+gAA62LTzQ (envelope-from ) for ; Sun, 24 Mar 2024 19:01:00 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1711303259; a=rsa-sha256; cv=none; b=YaoQk2dyyFsqVoBQIeRbG9oNaJEgWH/msB2pXJIdIV7OY420gO36Umdr1PFtEA0/b/IIxx KNQGGReNf3esJQhudrzOfyZKWWRLuUqOhj/sWn9UYSXQYtAAgx9+VDlL6g230gJKvl9OS0 kpga869qe5OMQCZL8rbx8pKo7FYNjH1NbVda6GSFxsXcKxk9Y7WwZBlgfTVz6khOOpJAnO yesVbNu6YDFUH+f9eXsWrkhsoeCB3cdFoQU+je7JH2D/DC3QptHSBj4ogpmfsW25zLwraJ AXPQOTQ4BODE7qob5Bg/PGru47nko8eI3M4PHuLyFnNgoIgKFhZ7u3l/NQkMfQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1711303259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=4BBJvTw9dJULDWNtW9Tc+P4GqcdAXBCi9mNjJZDPpf8=; b=on8ag8h4AFDvrBOLw7P17cTx9Fthscyn82ssRiH/t+eztQf0K0dnP3pMfYLyGJU/dXSnIR cpT7LNWnaka19KLt5JeBKyJ9T92QOjmP0B5qujGbbg6ylvgEwEl5MeIsRQoKXuh7zVAqYX p+IQQ6s1DNYU0v84xTfCsOQmSd/TFjQaCGwuofAhUBIqcQIIXoi38BIOWt/PCcMOX9yX74 zOkm4iGT9N1YgnE9tX4XtZNDzNiLtFagfPi49voVs9+ipB2AVxcjtvAuEnRt83NbPDKBe5 EeCVFuwOyATUIhkBzrGOlwaXaUZ4v2Nb9S1xALMPsZ32WS1IRZELJn+aMwmwdQ== Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 881051D685 for ; Sun, 24 Mar 2024 19:00:59 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 1F8795E50E; Sun, 24 Mar 2024 18:00:51 +0000 (UTC) X-Greylist: delayed 351 seconds by postgrey-1.36 at yantan; Sun, 24 Mar 2024 18:00:47 UTC Received: from 7.mo579.mail-out.ovh.net (7.mo579.mail-out.ovh.net [46.105.47.152]) by mail.notmuchmail.org (Postfix) with ESMTPS id E9C815E502 for ; Sun, 24 Mar 2024 18:00:47 +0000 (UTC) Received: from mxplan8.mail.ovh.net (unknown [10.108.2.179]) by mo579.mail-out.ovh.net (Postfix) with ESMTPS id 4V2kH3658fz1K15; Sun, 24 Mar 2024 17:54:55 +0000 (UTC) Received: from telenieko.com (37.59.142.109) by mxplan8.mail.ovh.net (172.16.2.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Sun, 24 Mar 2024 18:54:55 +0100 X-OVh-ClientIp: 2.152.92.61 From: Marc Fargas To: Carl Worth , , Subject: Re: notmuch.el, needs without-restriction to properly save draft In-Reply-To: <877chrsgr4.fsf@marcfargas.com> References: <87wmq6rt2f.fsf@marcfargas.com> <87frwtg2k6.fsf@wondoo.home.cworth.org> <877chrsgr4.fsf@marcfargas.com> User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.2 (x86_64-pc-linux-gnu) Date: Sun, 24 Mar 2024 18:54:53 +0100 Message-ID: <87wmprqzv6.fsf@marcfargas.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Ovh-Tracer-GUID: 1d1ea31c-1555-43cf-bca9-00c2954fd023 X-Ovh-Tracer-Id: 7561262300702510560 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledruddtjedguddtkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffujghffgffkfggtgesmhdtreertderjeenucfhrhhomhepofgrrhgtucfhrghrghgrshcuoehtvghlvghnihgvkhhosehtvghlvghnihgvkhhordgtohhmqeenucggtffrrghtthgvrhhnpeffiefguddtvdfhffduleegveehgfeftdfghffftdffledtuedtveehheeffeffvdenucfkphepuddvjedrtddrtddruddpvddrudehvddrledvrdeiuddpfeejrdehledrudegvddruddtleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepthgvlhgvnhhivghkohesthgvlhgvnhhivghkohdrtghomhdpnhgspghrtghpthhtohepgedprhgtphhtthhopegtfihorhhthhestgifohhrthhhrdhorhhgpdhrtghpthhtohepnhhothhmuhgthhesnhhothhmuhgthhhmrghilhdrohhrghdprhgtphhtthhopegurghvihgusehtvghthhgvrhgrrdhnvghtpdhrtghpthhtohepthgvlhgvnhhivghkohdofhgttgesghhmrghilhdrtghomhdpoffvtefjohhsthepmhhoheejledpmhhouggvpehsmhhtphhouhht Message-ID-Hash: KYXEHULTXY4WWJPDZNMFAMDEUKCDBKEI X-Message-ID-Hash: KYXEHULTXY4WWJPDZNMFAMDEUKCDBKEI X-MailFrom: telenieko@telenieko.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0 X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE X-Spam-Score: -3.91 X-Migadu-Queue-Id: 881051D685 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -3.91 X-TUID: Oh2IytOTWeW5 --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi again, El dom. 24 de mar. 2024, Marc escribi=C3=B3: > El mi=C3=A9. 13 de mar. 2024, Carl escribi=C3=B3: >> (...) >> Could you put your fix together in the form of a git-appliable patch? >> Such as by applying it to the notmuch source, running `git commit` and >> then `git format-patch HEAD~` or similar. > > Please disregard the previous patch, consider the one attached > here. Hope I did the "format-patch" thing properly. > > I had to move the `without-restriction` call to the top of the > `with-temporary-notmuch-message-buffer` defmacro. It does work properly > now. I just saw on the archives that David Bremner replied to my original patch, I have no idea why that email didn't reach me :( David:=20 > Although it is significantly more work, it would be very helpful if > you could come up with an automated test in the style of those in > T630-emacs-draft.sh. There is one that checks for an internal header, > so perhaps it could be modified to check for In-Reply-To? I am attaching a new patch that includes an additional test on T630-emacs-draft.sh. On the test only `References` is at the top (hence hidden by emacs), not `In-Reply-To`. I guess that does rely on some configuration. In any case, the test reproduces the problem (lost headers on draft save), and the patch fixes it! Hope all is good!! :D marc --=-=-= Content-Type: text/x-patch; charset="utf-8" Content-Disposition: attachment; filename="0001-Use-without-restriction-in-with-temporary-notmuch-me.patch" Content-Transfer-Encoding: quoted-printable >From 77e8a775571458962ff11af549d1a0428a17435e Mon Sep 17 00:00:00 2001 From: Marc Fargas Date: Thu, 14 Mar 2024 15:56:49 +0100 Subject: [PATCH] Use `without-restriction` in `with-temporary-notmuch-message-buffer` This ensures that the temporary copy of the current message-mode buffer is whole and not limited by a current restriction. An example of such restriction is the default one established by message-mode when composing a reply, that hides the References, In-Reply-To and similar headers. --- emacs/notmuch-maildir-fcc.el | 17 +++++++++-------- test/T630-emacs-draft.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index 5102078..cf50e85 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -145,14 +145,15 @@ Otherwise set it according to `notmuch-fcc-dirs'." =20 (defmacro with-temporary-notmuch-message-buffer (&rest body) "Set-up a temporary copy of the current message-mode buffer." - `(let ((case-fold-search t) - (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))) + `(without-restriction + (let ((case-fold-search t) + (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)))) =20 (defun notmuch-maildir-setup-message-for-saving () "Setup message for saving. diff --git a/test/T630-emacs-draft.sh b/test/T630-emacs-draft.sh index c443f41..1fad58a 100755 --- a/test/T630-emacs-draft.sh +++ b/test/T630-emacs-draft.sh @@ -71,4 +71,36 @@ Fcc: MAIL_DIR/sent <#secure method=3Dpgpmime mode=3Dsign> EOF test_expect_equal_file EXPECTED OUTPUT.clean + +add_email_corpus attachment +test_begin_subtest "Saving a draft keeps hidden headers" +test_emacs '(notmuch-mua-new-reply "id:874llc2bkp.fsf@curie.anarc.at") + (message-goto-subject) + (delete-line) + (insert "Subject: draft-test-reply\n") + (test-output "DRAFT") + (notmuch-draft-postpone) + (notmuch-show "subject:draft-test-reply") + (notmuch-show-resume-message) + (test-output)' +notmuch_dir_sanitize OUTPUT > OUTPUT.clean + +cat < EXPECTED +References: <87d10042pu.fsf@curie.anarc.at> <87woy8vx7i.fsf@tesseract.cs.u= nb.ca> <87a7v42bv9.fsf@curie.anarc.at> <874llc2bkp.fsf@curie.anarc.at> +From: Notmuch Test Suite +To: Antoine Beaupr=C3=A9 +Subject: draft-test-reply +In-Reply-To: <874llc2bkp.fsf@curie.anarc.at> +Fcc: MAIL_DIR/sent +--text follows this line-- +Antoine Beaupr=C3=A9 writes: + +> And obviously I forget the frigging attachment. +> +> +> PS: don't we have a "you forgot to actually attach the damn file" plugin +> when we detect the word "attachment" and there's no attach? :p +EOF +test_expect_equal_file EXPECTED OUTPUT.clean + test_done --=20 2.44.0 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --=-=-=--