unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Emacs: Indent first header line only when indentation is turned on
@ 2020-08-09 19:01 Teemu Likonen
  2020-08-10 10:19 ` David Edmondson
  0 siblings, 1 reply; 7+ messages in thread
From: Teemu Likonen @ 2020-08-09 19:01 UTC (permalink / raw)
  To: notmuch; +Cc: Teemu Likonen

Previously in message-show mode message's first header line (From
header) was always indented, even if user had turned thread
indentation off with "<" (notmuch-show-toggle-thread-indentation)
command.

This change modifies notmuch-show-insert-headerline function so that
it doesn't indent the first header line if notmuch-show-indent-content
variable is nil.
---
 emacs/notmuch-show.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 0eb27e33..2310017a 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -474,7 +474,10 @@ message at DEPTH in the current thread."
       ;; invisible U+200E LEFT-TO-RIGHT MARK character which forces
       ;; the header paragraph as left-to-right text.
       (insert (propertize (string ?\x200e) 'invisible t)))
-    (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
+    (insert (notmuch-show-spaces-n
+	     (if notmuch-show-indent-content
+		 (* notmuch-show-indent-messages-width depth)
+	       0))
 	    from
 	    " ("
 	    date
-- 
2.20.1

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

* Re: [PATCH] Emacs: Indent first header line only when indentation is turned on
  2020-08-09 19:01 [PATCH] Emacs: Indent first header line only when indentation is turned on Teemu Likonen
@ 2020-08-10 10:19 ` David Edmondson
  2020-08-10 14:37   ` [PATCH v2] " Teemu Likonen
  0 siblings, 1 reply; 7+ messages in thread
From: David Edmondson @ 2020-08-10 10:19 UTC (permalink / raw)
  To: Teemu Likonen, notmuch; +Cc: Teemu Likonen

On Sunday, 2020-08-09 at 22:01:44 +03, Teemu Likonen wrote:

> Previously in message-show mode message's first header line (From
> header) was always indented, even if user had turned thread
> indentation off with "<" (notmuch-show-toggle-thread-indentation)
> command.
>
> This change modifies notmuch-show-insert-headerline function so that
> it doesn't indent the first header line if notmuch-show-indent-content
> variable is nil.
> ---
>  emacs/notmuch-show.el | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 0eb27e33..2310017a 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -474,7 +474,10 @@ message at DEPTH in the current thread."
>        ;; invisible U+200E LEFT-TO-RIGHT MARK character which forces
>        ;; the header paragraph as left-to-right text.
>        (insert (propertize (string ?\x200e) 'invisible t)))
> -    (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
> +    (insert (notmuch-show-spaces-n
> +	     (if notmuch-show-indent-content
> +		 (* notmuch-show-indent-messages-width depth)
> +	       0))

Couldn't you also elide the call to `notmuch-show-spaces-n'?

>  	    from
>  	    " ("
>  	    date
> -- 
> 2.20.1
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

dme.
-- 
I walk like a building, I never get wet.

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

* [PATCH v2] Emacs: Indent first header line only when indentation is turned on
  2020-08-10 10:19 ` David Edmondson
@ 2020-08-10 14:37   ` Teemu Likonen
  2020-08-10 16:15     ` David Edmondson
  2020-08-12 23:38     ` David Bremner
  0 siblings, 2 replies; 7+ messages in thread
From: Teemu Likonen @ 2020-08-10 14:37 UTC (permalink / raw)
  To: David Edmondson, notmuch; +Cc: Teemu Likonen

Previously in message-show mode message's first header line (From
header) was always indented, even if user had turned thread
indentation off with "<" (notmuch-show-toggle-thread-indentation)
command.

This change modifies notmuch-show-insert-headerline function so that
it doesn't indent the first header line if notmuch-show-indent-content
variable is nil.
---
 emacs/notmuch-show.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


* 2020-08-10 11:19:10+01, David Edmondson wrote:
>> +    (insert (notmuch-show-spaces-n
>> +	     (if notmuch-show-indent-content
>> +		 (* notmuch-show-indent-messages-width depth)
>> +	       0))
>
> Couldn't you also elide the call to `notmuch-show-spaces-n'?

Indeed.



diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 0eb27e33..444b2a45 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -474,7 +474,10 @@ message at DEPTH in the current thread."
       ;; invisible U+200E LEFT-TO-RIGHT MARK character which forces
       ;; the header paragraph as left-to-right text.
       (insert (propertize (string ?\x200e) 'invisible t)))
-    (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
+    (insert (if notmuch-show-indent-content
+		(notmuch-show-spaces-n (* notmuch-show-indent-messages-width
+					  depth))
+	      "")
 	    from
 	    " ("
 	    date
-- 
2.20.1

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

* Re: [PATCH v2] Emacs: Indent first header line only when indentation is turned on
  2020-08-10 14:37   ` [PATCH v2] " Teemu Likonen
@ 2020-08-10 16:15     ` David Edmondson
  2020-08-12 23:38     ` David Bremner
  1 sibling, 0 replies; 7+ messages in thread
From: David Edmondson @ 2020-08-10 16:15 UTC (permalink / raw)
  To: Teemu Likonen, notmuch; +Cc: Teemu Likonen

On Monday, 2020-08-10 at 17:37:57 +03, Teemu Likonen wrote:

> Previously in message-show mode message's first header line (From
> header) was always indented, even if user had turned thread
> indentation off with "<" (notmuch-show-toggle-thread-indentation)
> command.
>
> This change modifies notmuch-show-insert-headerline function so that
> it doesn't indent the first header line if notmuch-show-indent-content
> variable is nil.

Reviewed-by: David Edmondson <dme@dme.org>

> ---
>  emacs/notmuch-show.el | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
>
> * 2020-08-10 11:19:10+01, David Edmondson wrote:
>>> +    (insert (notmuch-show-spaces-n
>>> +	     (if notmuch-show-indent-content
>>> +		 (* notmuch-show-indent-messages-width depth)
>>> +	       0))
>>
>> Couldn't you also elide the call to `notmuch-show-spaces-n'?
>
> Indeed.
>
>
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 0eb27e33..444b2a45 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -474,7 +474,10 @@ message at DEPTH in the current thread."
>        ;; invisible U+200E LEFT-TO-RIGHT MARK character which forces
>        ;; the header paragraph as left-to-right text.
>        (insert (propertize (string ?\x200e) 'invisible t)))
> -    (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
> +    (insert (if notmuch-show-indent-content
> +		(notmuch-show-spaces-n (* notmuch-show-indent-messages-width
> +					  depth))
> +	      "")
>  	    from
>  	    " ("
>  	    date
> -- 
> 2.20.1

dme.
-- 
I used to get mad at my school, the teachers who taught me weren't cool.

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

* Re: [PATCH v2] Emacs: Indent first header line only when indentation is turned on
  2020-08-10 14:37   ` [PATCH v2] " Teemu Likonen
  2020-08-10 16:15     ` David Edmondson
@ 2020-08-12 23:38     ` David Bremner
  2020-08-15  6:28       ` [PATCH v3] " Teemu Likonen
  1 sibling, 1 reply; 7+ messages in thread
From: David Bremner @ 2020-08-12 23:38 UTC (permalink / raw)
  To: Teemu Likonen, David Edmondson, notmuch; +Cc: Teemu Likonen

Teemu Likonen <tlikonen@iki.fi> writes:


> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 0eb27e33..444b2a45 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -474,7 +474,10 @@ message at DEPTH in the current thread."
>        ;; invisible U+200E LEFT-TO-RIGHT MARK character which forces
>        ;; the header paragraph as left-to-right text.
>        (insert (propertize (string ?\x200e) 'invisible t)))
> -    (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
> +    (insert (if notmuch-show-indent-content
> +		(notmuch-show-spaces-n (* notmuch-show-indent-messages-width
> +					  depth))
> +	      "")
>  	    from
>  	    " ("
>  	    date

the test "notmuch-show: disable indentation of thread content (w/
notmuch-show-toggle-thread-indentation)" in T450-emacs-show needs to be
adjusted for this change (i.e. it fails as is).

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

* [PATCH v3] Emacs: Indent first header line only when indentation is turned on
  2020-08-12 23:38     ` David Bremner
@ 2020-08-15  6:28       ` Teemu Likonen
  2020-08-15 12:23         ` David Bremner
  0 siblings, 1 reply; 7+ messages in thread
From: Teemu Likonen @ 2020-08-15  6:28 UTC (permalink / raw)
  To: David Bremner, David Edmondson, notmuch

Previously in message-show mode message's first header line (From
header) was always indented, even if user had turned thread
indentation off with "<" (notmuch-show-toggle-thread-indentation)
command.

This change modifies notmuch-show-insert-headerline function so that
it doesn't indent the first header line if notmuch-show-indent-content
variable is nil.

This change also modifies tests so that they expect this new output
format:
test/emacs-show.expected-output/notmuch-show-indent-thread-content-off
---
 emacs/notmuch-show.el                                |  5 ++++-
 .../notmuch-show-indent-thread-content-off           | 12 ++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)


* 2020-08-12 20:38:06-03, David Bremner wrote:
> the test "notmuch-show: disable indentation of thread content (w/
> notmuch-show-toggle-thread-indentation)" in T450-emacs-show needs to be
> adjusted for this change (i.e. it fails as is).

Thanks. This version has updated test output files.


diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 0eb27e33..444b2a45 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -474,7 +474,10 @@ message at DEPTH in the current thread."
       ;; invisible U+200E LEFT-TO-RIGHT MARK character which forces
       ;; the header paragraph as left-to-right text.
       (insert (propertize (string ?\x200e) 'invisible t)))
-    (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
+    (insert (if notmuch-show-indent-content
+		(notmuch-show-spaces-n (* notmuch-show-indent-messages-width
+					  depth))
+	      "")
 	    from
 	    " ("
 	    date
diff --git a/test/emacs-show.expected-output/notmuch-show-indent-thread-content-off b/test/emacs-show.expected-output/notmuch-show-indent-thread-content-off
index 1a06374d..0bb58330 100644
--- a/test/emacs-show.expected-output/notmuch-show-indent-thread-content-off
+++ b/test/emacs-show.expected-output/notmuch-show-indent-thread-content-off
@@ -31,8 +31,8 @@ Cheers,
 [ application/pgp-signature ]
 [ text/plain ]
 [ 4-line signature. Click/Enter to show. ]
- Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
-  Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
+Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox signed unread)
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-17) (inbox signed)
 Subject: Re: [notmuch] Working with Maildir storage?
 To: Mikhail Gusarov <dottedmag@dottedmag.net>
 Cc: notmuch@notmuchmail.org
@@ -57,9 +57,9 @@ It doesn't look like the patch is in git yet.
 [ application/pgp-signature ]
 [ text/plain ]
 [ 4-line signature. Click/Enter to show. ]
-   Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
-   Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
-    Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
+Mikhail Gusarov <dottedmag@dottedmag.net> (2009-11-17) (inbox unread)
+Keith Packard <keithp@keithp.com> (2009-11-17) (inbox unread)
+Lars Kellogg-Stedman <lars@seas.harvard.edu> (2009-11-18) (inbox signed unread)
 Subject: Re: [notmuch] Working with Maildir storage?
 To: Keith Packard <keithp@keithp.com>
 Cc: notmuch@notmuchmail.org
@@ -79,4 +79,4 @@ missing "#include <stdint.h>" (for the uint32_t on line 466).
 [ application/pgp-signature ]
 [ text/plain ]
 [ 4-line signature. Click/Enter to show. ]
- Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
+Carl Worth <cworth@cworth.org> (2009-11-18) (inbox unread)
-- 
2.20.1

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

* Re: [PATCH v3] Emacs: Indent first header line only when indentation is turned on
  2020-08-15  6:28       ` [PATCH v3] " Teemu Likonen
@ 2020-08-15 12:23         ` David Bremner
  0 siblings, 0 replies; 7+ messages in thread
From: David Bremner @ 2020-08-15 12:23 UTC (permalink / raw)
  To: Teemu Likonen, David Edmondson, notmuch

Teemu Likonen <tlikonen@iki.fi> writes:

> Previously in message-show mode message's first header line (From
> header) was always indented, even if user had turned thread
> indentation off with "<" (notmuch-show-toggle-thread-indentation)
> command.
>
> This change modifies notmuch-show-insert-headerline function so that
> it doesn't indent the first header line if notmuch-show-indent-content
> variable is nil.
>
> This change also modifies tests so that they expect this new output
> format:
> test/emacs-show.expected-output/notmuch-show-indent-thread-content-off

Applied to master

d

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

end of thread, other threads:[~2020-08-15 12:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-09 19:01 [PATCH] Emacs: Indent first header line only when indentation is turned on Teemu Likonen
2020-08-10 10:19 ` David Edmondson
2020-08-10 14:37   ` [PATCH v2] " Teemu Likonen
2020-08-10 16:15     ` David Edmondson
2020-08-12 23:38     ` David Bremner
2020-08-15  6:28       ` [PATCH v3] " Teemu Likonen
2020-08-15 12:23         ` 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).