unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 0/2] emacs: wash: word-wrap bugfix and tweak
@ 2016-08-06 15:29 Mark Walters
  2016-08-06 15:29 ` [PATCH 1/2] emacs: wash: word-wrap bugfix Mark Walters
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mark Walters @ 2016-08-06 15:29 UTC (permalink / raw)
  To: notmuch

Jani pointed out on irc that there was a bug in notmuch-tree that when
a message very deep in a thread is viewed in the message pane it is
wordwrapped too soon.

This is actually a bug in notmuch-wash: it assumes that
notmuch-show-indent-messages-width is 1, so that the indentation of
the message is equal to its depth in the thread.

The first patch fixes the bug, and uses the correct indentation.

The second patch is a version of
id:1467791251-6823-1-git-send-email-markwalters1009@gmail.com on
on top of the first patch above.

The first patch is a clear bugfix and can be applied on its own.

The second is a change; I think the new version is the natural
interpretation of notmuch-word-wrap-lines-length so have removed the
old behaviour. See the message
id:1467791251-6823-1-git-send-email-markwalters1009@gmail.com for more
details of the change.

Best wishes

Mark





Mark Walters (2):
  emacs: wash: word-wrap bugfix
  emacs: wash: make word-wrap bound message width

 emacs/notmuch-wash.el                                 | 10 ++++++----
 ...w-thread-maildir-storage-with-fourfold-indentation | 19 ++++++++++++-------
 ...ch-show-thread-maildir-storage-without-indentation |  8 ++++----
 3 files changed, 22 insertions(+), 15 deletions(-)

-- 
2.1.4

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

* [PATCH 1/2] emacs: wash: word-wrap bugfix
  2016-08-06 15:29 [PATCH 0/2] emacs: wash: word-wrap bugfix and tweak Mark Walters
@ 2016-08-06 15:29 ` Mark Walters
  2016-08-09  0:49   ` David Bremner
  2016-08-06 15:29 ` [PATCH 2/2] emacs: wash: make word-wrap bound message width Mark Walters
  2016-08-06 19:45 ` [PATCH 0/2] emacs: wash: word-wrap bugfix and tweak Tomi Ollila
  2 siblings, 1 reply; 6+ messages in thread
From: Mark Walters @ 2016-08-06 15:29 UTC (permalink / raw)
  To: notmuch

Previously notmuch-wash made the width of the text (approximately) the
window-width minus the depth in thread. This is correct for the
default indentation of 1 per message depth, but is incorrect for any
other setting of notmuch-show-indent-messages-width.

As notmuch-show-indent-messages-width is customisable, and notmuch-tree
sets it to zero to avoid indenting messages in the message pane, this
bug can show up in real use.

Two of the tests had to be updated: when
notmuch-show-indent-messages-width is 0, then the new (correct) word
wrapping happens later, when notmuch-show-indent-messages-width is 4,
then the new word wrapping happens sooner.
---
 emacs/notmuch-wash.el                                 |  4 +++-
 ...w-thread-maildir-storage-with-fourfold-indentation | 19 ++++++++++++-------
 ...ch-show-thread-maildir-storage-without-indentation |  8 ++++----
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 57e6dfa..07fc1a1 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -26,6 +26,7 @@
 (require 'coolj)
 
 (declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide))
+(defvar notmuch-show-indent-messages-width)
 
 ;;
 
@@ -335,12 +336,13 @@ message at the window width. When doing so, citation leaders in
 the wrapped text are maintained."
 
   (let* ((coolj-wrap-follows-window-size nil)
+	 (indent (* depth notmuch-show-indent-messages-width))
 	 (limit (if (numberp notmuch-wash-wrap-lines-length)
 		    (min notmuch-wash-wrap-lines-length
 			 (window-width))
 		  (window-width)))
 	 (fill-column (- limit
-			 depth
+			 indent
 			 ;; 2 to avoid poor interaction with
 			 ;; `word-wrap'.
 			 2)))
diff --git a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation
index 4721b8b..3bbb114 100644
--- a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation
+++ b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-with-fourfold-indentation
@@ -109,12 +109,14 @@ http://notmuchmail.org/mailman/listinfo/notmuch
 	    To: notmuch@notmuchmail.org
 	    Date: Wed, 18 Nov 2009 02:50:48 +0600
 
-	    Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu
-	    did gyre and gimble:
+	    Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at
+	    seas.harvard.edu did gyre and gimble:
 
 	     LK> Is the list archived anywhere?  The obvious archives
-	     LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
-	     LK> think I subscribed too late to get the patch (I only just saw the
+	     LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available,
+	    and I
+	     LK> think I subscribed too late to get the patch (I only just saw
+	    the
 	     LK> discussion about it).
 
 	     LK> It doesn't look like the patch is in git yet.
@@ -141,7 +143,8 @@ http://notmuchmail.org/mailman/listinfo/notmuch
 	    seas.harvard.edu> wrote:
 	    > > See the patch just posted here.
 
-	    I've also pushed a slightly more complicated (and complete) fix to my
+	    I've also pushed a slightly more complicated (and complete) fix to
+	    my
 	    private notmuch repository
 
 	    git://keithp.com/git/notmuch
@@ -164,10 +167,12 @@ http://notmuchmail.org/mailman/listinfo/notmuch
 		[ multipart/signed ]
 		[ Unknown signature status ]
 		[ text/plain ]
-		> I've also pushed a slightly more complicated (and complete) fix to my
+		> I've also pushed a slightly more complicated (and complete)
+		> fix to my
 		> private notmuch repository
 
-		The version of lib/messages.cc in your repo doesn't build because it's
+		The version of lib/messages.cc in your repo doesn't build
+		because it's
 		missing "#include <stdint.h>" (for the uint32_t on line 466).
 
 		[ 4-line signature. Click/Enter to show. ]
diff --git a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation
index 62a4635..620caa0 100644
--- a/test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation
+++ b/test/emacs.expected-output/notmuch-show-thread-maildir-storage-without-indentation
@@ -49,8 +49,8 @@ Date: Wed, 18 Nov 2009 01:02:38 +0600
 [ Unknown signature status ]
 [ text/plain ]
 
-Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did
-gyre and gimble:
+Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did gyre
+and gimble:
 
  LK> Resulted in 4604 lines of errors along the lines of:
 
@@ -109,8 +109,8 @@ Subject: [notmuch] Working with Maildir storage?
 To: notmuch@notmuchmail.org
 Date: Wed, 18 Nov 2009 02:50:48 +0600
 
-Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu
-did gyre and gimble:
+Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu did
+gyre and gimble:
 
  LK> Is the list archived anywhere?  The obvious archives
  LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I
-- 
2.1.4

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

* [PATCH 2/2] emacs: wash: make word-wrap bound message width
  2016-08-06 15:29 [PATCH 0/2] emacs: wash: word-wrap bugfix and tweak Mark Walters
  2016-08-06 15:29 ` [PATCH 1/2] emacs: wash: word-wrap bugfix Mark Walters
@ 2016-08-06 15:29 ` Mark Walters
  2016-09-12 11:08   ` David Bremner
  2016-08-06 19:45 ` [PATCH 0/2] emacs: wash: word-wrap bugfix and tweak Tomi Ollila
  2 siblings, 1 reply; 6+ messages in thread
From: Mark Walters @ 2016-08-06 15:29 UTC (permalink / raw)
  To: notmuch

Previously if notmuch-wash-wrap-lines-length was set then all messages
would be wrapped at this value (or window-width if that is
smaller). This was done regardless of the message's depth in a thread --
for example, if the n.w.w.l.l is 80 and the messages depth is 20
(so indented 20 by default) the messages text only got 60 characters
of space.

This commit changes that so a message always gets the full n.w.w.l.l
of width regardless of its indentation (unless that goes over
window-width of course).
---
 emacs/notmuch-wash.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
index 07fc1a1..5f8b926 100644
--- a/emacs/notmuch-wash.el
+++ b/emacs/notmuch-wash.el
@@ -122,8 +122,8 @@ collapse the remaining lines into a button."
 
 If this is nil, lines in messages will be wrapped to fit in the
 current window. If this is a number, lines will be wrapped after
-this many characters or at the window width (whichever one is
-lower)."
+this many characters (ignoring indentation due to thread depth)
+or at the window width (whichever one is lower)."
   :type '(choice (const :tag "window width" nil)
 		 (integer :tag "number of characters"))
   :group 'notmuch-wash)
@@ -338,7 +338,7 @@ the wrapped text are maintained."
   (let* ((coolj-wrap-follows-window-size nil)
 	 (indent (* depth notmuch-show-indent-messages-width))
 	 (limit (if (numberp notmuch-wash-wrap-lines-length)
-		    (min notmuch-wash-wrap-lines-length
+		    (min (+ notmuch-wash-wrap-lines-length indent)
 			 (window-width))
 		  (window-width)))
 	 (fill-column (- limit
-- 
2.1.4

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

* Re: [PATCH 0/2] emacs: wash: word-wrap bugfix and tweak
  2016-08-06 15:29 [PATCH 0/2] emacs: wash: word-wrap bugfix and tweak Mark Walters
  2016-08-06 15:29 ` [PATCH 1/2] emacs: wash: word-wrap bugfix Mark Walters
  2016-08-06 15:29 ` [PATCH 2/2] emacs: wash: make word-wrap bound message width Mark Walters
@ 2016-08-06 19:45 ` Tomi Ollila
  2 siblings, 0 replies; 6+ messages in thread
From: Tomi Ollila @ 2016-08-06 19:45 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Sat, Aug 06 2016, Mark Walters <markwalters1009@gmail.com> wrote:

> Jani pointed out on irc that there was a bug in notmuch-tree that when
> a message very deep in a thread is viewed in the message pane it is
> wordwrapped too soon.
>
> This is actually a bug in notmuch-wash: it assumes that
> notmuch-show-indent-messages-width is 1, so that the indentation of
> the message is equal to its depth in the thread.
>
> The first patch fixes the bug, and uses the correct indentation.
>
> The second patch is a version of
> id:1467791251-6823-1-git-send-email-markwalters1009@gmail.com on
> on top of the first patch above.
>
> The first patch is a clear bugfix and can be applied on its own.
>
> The second is a change; I think the new version is the natural
> interpretation of notmuch-word-wrap-lines-length so have removed the
> old behaviour. See the message
> id:1467791251-6823-1-git-send-email-markwalters1009@gmail.com for more
> details of the change.

The bugfix and the change both looks good to me. I have not (yet) tested
these for the time being...

Tomi


>
> Best wishes
>
> Mark
>
>
>
>
>
> Mark Walters (2):
>   emacs: wash: word-wrap bugfix
>   emacs: wash: make word-wrap bound message width
>
>  emacs/notmuch-wash.el                                 | 10 ++++++----
>  ...w-thread-maildir-storage-with-fourfold-indentation | 19 ++++++++++++-------
>  ...ch-show-thread-maildir-storage-without-indentation |  8 ++++----
>  3 files changed, 22 insertions(+), 15 deletions(-)
>
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH 1/2] emacs: wash: word-wrap bugfix
  2016-08-06 15:29 ` [PATCH 1/2] emacs: wash: word-wrap bugfix Mark Walters
@ 2016-08-09  0:49   ` David Bremner
  0 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2016-08-09  0:49 UTC (permalink / raw)
  To: Mark Walters, notmuch

Mark Walters <markwalters1009@gmail.com> writes:

> Previously notmuch-wash made the width of the text (approximately) the
> window-width minus the depth in thread. This is correct for the
> default indentation of 1 per message depth, but is incorrect for any
> other setting of notmuch-show-indent-messages-width.

Pushed this one patch.

d

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

* Re: [PATCH 2/2] emacs: wash: make word-wrap bound message width
  2016-08-06 15:29 ` [PATCH 2/2] emacs: wash: make word-wrap bound message width Mark Walters
@ 2016-09-12 11:08   ` David Bremner
  0 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2016-09-12 11:08 UTC (permalink / raw)
  To: Mark Walters, notmuch

Mark Walters <markwalters1009@gmail.com> writes:

> This commit changes that so a message always gets the full n.w.w.l.l
> of width regardless of its indentation (unless that goes over
> window-width of course).

pushed

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

end of thread, other threads:[~2016-09-12 11:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-06 15:29 [PATCH 0/2] emacs: wash: word-wrap bugfix and tweak Mark Walters
2016-08-06 15:29 ` [PATCH 1/2] emacs: wash: word-wrap bugfix Mark Walters
2016-08-09  0:49   ` David Bremner
2016-08-06 15:29 ` [PATCH 2/2] emacs: wash: make word-wrap bound message width Mark Walters
2016-09-12 11:08   ` David Bremner
2016-08-06 19:45 ` [PATCH 0/2] emacs: wash: word-wrap bugfix and tweak Tomi Ollila

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