unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* emacs: reply subject sanitization
@ 2017-09-26 18:26 Jani Nikula
  2017-09-26 18:26 ` [PATCH 1/2] test: add emacs reply test for subjects with TAB Jani Nikula
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jani Nikula @ 2017-09-26 18:26 UTC (permalink / raw)
  To: notmuch

v2 of id:20170915155716.19597-1-jani@nikula.org, now with test.

BR,
Jani.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] test: add emacs reply test for subjects with TAB
  2017-09-26 18:26 emacs: reply subject sanitization Jani Nikula
@ 2017-09-26 18:26 ` Jani Nikula
  2017-09-26 18:26 ` [PATCH 2/2] emacs: sanitize subject in replies Jani Nikula
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jani Nikula @ 2017-09-26 18:26 UTC (permalink / raw)
  To: notmuch

Expect TABs to be sanitized from the subject line. Known broken.
---
 test/T310-emacs.sh | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index fde11790a600..2ef566bac490 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -401,6 +401,29 @@ Notmuch Test Suite <test_suite@notmuchmail.org> writes:
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "Reply within emacs to a message with TAB in subject"
+test_subtest_known_broken
+test_emacs '(let ((message-hidden-headers ''()))
+	    (notmuch-search "id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net")
+	    (notmuch-test-wait)
+	    (notmuch-search-show-thread)
+	    (notmuch-test-wait)
+	    (notmuch-show-reply-sender)
+	    (test-output))'
+sed -i -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' OUTPUT
+sed -i -e 's/^References: <.*>$/References: <XXX>/' OUTPUT
+sed -i -e '/^--text follows this line--$/q' OUTPUT
+cat <<EOF >EXPECTED
+From: Notmuch Test Suite <test_suite@notmuchmail.org>
+To: Mikhail Gusarov <dottedmag@dottedmag.net>
+Subject: Re: [notmuch] [PATCH 1/2] Close message file after parsing message headers
+In-Reply-To: <XXX>
+Fcc: ${MAIL_DIR}/sent
+References: <XXX>
+--text follows this line--
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "Reply from alternate address within emacs"
 add_message '[from]="Sender <sender@example.com>"' \
 	     [to]=test_suite_other@notmuchmail.org
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] emacs: sanitize subject in replies
  2017-09-26 18:26 emacs: reply subject sanitization Jani Nikula
  2017-09-26 18:26 ` [PATCH 1/2] test: add emacs reply test for subjects with TAB Jani Nikula
@ 2017-09-26 18:26 ` Jani Nikula
  2017-09-26 20:56 ` emacs: reply subject sanitization David Edmondson
  2017-09-27 11:20 ` David Bremner
  3 siblings, 0 replies; 5+ messages in thread
From: Jani Nikula @ 2017-09-26 18:26 UTC (permalink / raw)
  To: notmuch

Commit a7964c86d125 ("emacs: Sanitize authors and subjects in search
and show") added sanitization of header information for display. Do
the same for reply subjects.

This fixes the long-standing annoying artefact of certain versions of
mailman using tab as folding whitespace, leading to tabs in reply
subjects.
---
 emacs/notmuch-mua.el | 2 +-
 test/T310-emacs.sh   | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index fd64b362b542..7a341ebf0588 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -218,7 +218,7 @@ mutiple parts get a header."
 		     else
 		     collect pair)))
 	  (notmuch-mua-mail (plist-get reply-headers :To)
-			    (plist-get reply-headers :Subject)
+			    (notmuch-sanitize (plist-get reply-headers :Subject))
 			    (notmuch-headers-plist-to-alist reply-headers)
 			    nil (notmuch-mua-get-switch-function))))
 
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 2ef566bac490..4456bc659158 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -402,7 +402,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "Reply within emacs to a message with TAB in subject"
-test_subtest_known_broken
 test_emacs '(let ((message-hidden-headers ''()))
 	    (notmuch-search "id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net")
 	    (notmuch-test-wait)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: emacs: reply subject sanitization
  2017-09-26 18:26 emacs: reply subject sanitization Jani Nikula
  2017-09-26 18:26 ` [PATCH 1/2] test: add emacs reply test for subjects with TAB Jani Nikula
  2017-09-26 18:26 ` [PATCH 2/2] emacs: sanitize subject in replies Jani Nikula
@ 2017-09-26 20:56 ` David Edmondson
  2017-09-27 11:20 ` David Bremner
  3 siblings, 0 replies; 5+ messages in thread
From: David Edmondson @ 2017-09-26 20:56 UTC (permalink / raw)
  To: Jani Nikula, notmuch

On Tuesday, 2017-09-26 at 21:26:06 +0300, Jani Nikula wrote:

> v2 of id:20170915155716.19597-1-jani@nikula.org, now with test.

Looks good.

dme.
-- 
I can't explain, you would not understand. This is not how I am.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: emacs: reply subject sanitization
  2017-09-26 18:26 emacs: reply subject sanitization Jani Nikula
                   ` (2 preceding siblings ...)
  2017-09-26 20:56 ` emacs: reply subject sanitization David Edmondson
@ 2017-09-27 11:20 ` David Bremner
  3 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2017-09-27 11:20 UTC (permalink / raw)
  To: Jani Nikula, notmuch

Jani Nikula <jani@nikula.org> writes:

> v2 of id:20170915155716.19597-1-jani@nikula.org, now with test.
>
> BR,
> Jani.

pushed.

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-27 11:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-26 18:26 emacs: reply subject sanitization Jani Nikula
2017-09-26 18:26 ` [PATCH 1/2] test: add emacs reply test for subjects with TAB Jani Nikula
2017-09-26 18:26 ` [PATCH 2/2] emacs: sanitize subject in replies Jani Nikula
2017-09-26 20:56 ` emacs: reply subject sanitization David Edmondson
2017-09-27 11:20 ` David Bremner

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