unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] test/emacs: known broken test for reply with extra headers set.
@ 2022-01-19  1:14 David Bremner
  2022-01-19  1:34 ` [PATCH] CLI: print extra headers only for non-replies David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: David Bremner @ 2022-01-19  1:14 UTC (permalink / raw)
  To: notmuch

Although it makes sense for the extra headers to be added to the copy
of the message headers included in the sexp/json, it is a bit
surprising for them to show in the new message constructed for the
reply, especially when, as here, they are always missing/empty.
---
 test/T310-emacs.sh | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 1b6660f0..831df1cc 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -485,6 +485,32 @@ Sender <sender@example.com> writes:
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "Reply with show.extra_headers set"
+test_subtest_known_broken
+notmuch config set show.extra_headers Received
+add_message '[from]="Sender <sender@example.com>"' \
+	     [to]=test_suite_other@notmuchmail.org
+
+test_emacs "(let ((message-hidden-headers '()))
+	    (notmuch-search \"id:\\\"${gen_msg_id}\\\"\")
+	    (notmuch-test-wait)
+	    (notmuch-search-reply-to-thread)
+	    (test-output))"
+cat <<EOF >EXPECTED
+From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
+To: Sender <sender@example.com>
+Subject: Re: ${test_subtest_name}
+In-Reply-To: <${gen_msg_id}>
+Fcc: ${MAIL_DIR}/sent
+References: <${gen_msg_id}>
+--text follows this line--
+Sender <sender@example.com> writes:
+
+> This is just a test message (#${gen_msg_cnt})
+EOF
+notmuch config set show.extra_headers
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "Reply from address in named group list within emacs"
 add_message '[from]="Sender <sender@example.com>"' \
             '[to]=group:test_suite@notmuchmail.org,someone@example.com\;' \
@@ -680,7 +706,7 @@ References: <XXX>
 --text follows this line--
 test_suite@notmuchmail.org writes:
 
-> This is just a test message (#7)
+> This is just a test message (#${gen_msg_cnt})
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
-- 
2.34.1

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

* [PATCH] CLI: print extra headers only for non-replies
  2022-01-19  1:14 [PATCH] test/emacs: known broken test for reply with extra headers set David Bremner
@ 2022-01-19  1:34 ` David Bremner
  2022-01-19 20:47   ` Tomi Ollila
  0 siblings, 1 reply; 4+ messages in thread
From: David Bremner @ 2022-01-19  1:34 UTC (permalink / raw)
  To: David Bremner, notmuch

If in the future we decide to output extra headers for replies, this
should be controlled by a separate configuration option.
---
 notmuch-show.c     | 3 ++-
 test/T310-emacs.sh | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 136f4439..6a54d9c1 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -294,7 +294,8 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
     }
 
     /* Output extra headers the user has configured, if any */
-    format_extra_headers_sprinter (sp, message);
+    if (! reply)
+	format_extra_headers_sprinter (sp, message);
     sp->end (sp);
     talloc_free (local);
 }
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index 831df1cc..a05b828a 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -486,7 +486,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "Reply with show.extra_headers set"
-test_subtest_known_broken
 notmuch config set show.extra_headers Received
 add_message '[from]="Sender <sender@example.com>"' \
 	     [to]=test_suite_other@notmuchmail.org
-- 
2.34.1

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

* Re: [PATCH] CLI: print extra headers only for non-replies
  2022-01-19  1:34 ` [PATCH] CLI: print extra headers only for non-replies David Bremner
@ 2022-01-19 20:47   ` Tomi Ollila
  2022-01-20  0:00     ` David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: Tomi Ollila @ 2022-01-19 20:47 UTC (permalink / raw)
  To: David Bremner, David Bremner, notmuch

On Tue, Jan 18 2022, David Bremner wrote:

> If in the future we decide to output extra headers for replies, this
> should be controlled by a separate configuration option.
> ---
>  notmuch-show.c     | 3 ++-
>  test/T310-emacs.sh | 1 -
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/notmuch-show.c b/notmuch-show.c
> index 136f4439..6a54d9c1 100644
> --- a/notmuch-show.c
> +++ b/notmuch-show.c
> @@ -294,7 +294,8 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
>      }
>  
>      /* Output extra headers the user has configured, if any */
> -    format_extra_headers_sprinter (sp, message);
> +    if (! reply)
> +	format_extra_headers_sprinter (sp, message);

Looks simple enough for LGTM.

Tomi

>      sp->end (sp);
>      talloc_free (local);
>  }
> diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
> index 831df1cc..a05b828a 100755
> --- a/test/T310-emacs.sh
> +++ b/test/T310-emacs.sh
> @@ -486,7 +486,6 @@ EOF
>  test_expect_equal_file EXPECTED OUTPUT
>  
>  test_begin_subtest "Reply with show.extra_headers set"
> -test_subtest_known_broken
>  notmuch config set show.extra_headers Received
>  add_message '[from]="Sender <sender@example.com>"' \
>  	     [to]=test_suite_other@notmuchmail.org
> -- 
> 2.34.1
>
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

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

* Re: [PATCH] CLI: print extra headers only for non-replies
  2022-01-19 20:47   ` Tomi Ollila
@ 2022-01-20  0:00     ` David Bremner
  0 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2022-01-20  0:00 UTC (permalink / raw)
  To: Tomi Ollila, notmuch

Tomi Ollila <tomi.ollila@iki.fi> writes:

> On Tue, Jan 18 2022, David Bremner wrote:
>
>> If in the future we decide to output extra headers for replies, this
>> should be controlled by a separate configuration option.
>> ---
>>  notmuch-show.c     | 3 ++-
>>  test/T310-emacs.sh | 1 -
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/notmuch-show.c b/notmuch-show.c
>> index 136f4439..6a54d9c1 100644
>> --- a/notmuch-show.c
>> +++ b/notmuch-show.c
>> @@ -294,7 +294,8 @@ format_headers_sprinter (sprinter_t *sp, GMimeMessage *message,
>>      }
>>  
>>      /* Output extra headers the user has configured, if any */
>> -    format_extra_headers_sprinter (sp, message);
>> +    if (! reply)
>> +	format_extra_headers_sprinter (sp, message);
>
> Looks simple enough for LGTM.
>

applied to master

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

end of thread, other threads:[~2022-01-20  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19  1:14 [PATCH] test/emacs: known broken test for reply with extra headers set David Bremner
2022-01-19  1:34 ` [PATCH] CLI: print extra headers only for non-replies David Bremner
2022-01-19 20:47   ` Tomi Ollila
2022-01-20  0:00     ` 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).