emacs: wash: word-wrap bugfix

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.
This commit is contained in:
Mark Walters 2016-08-06 16:29:33 +01:00 committed by David Bremner
parent 293186d6c6
commit 999d473299
3 changed files with 19 additions and 12 deletions

View file

@ -26,6 +26,7 @@
(require 'coolj) (require 'coolj)
(declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide)) (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." the wrapped text are maintained."
(let* ((coolj-wrap-follows-window-size nil) (let* ((coolj-wrap-follows-window-size nil)
(indent (* depth notmuch-show-indent-messages-width))
(limit (if (numberp notmuch-wash-wrap-lines-length) (limit (if (numberp notmuch-wash-wrap-lines-length)
(min notmuch-wash-wrap-lines-length (min notmuch-wash-wrap-lines-length
(window-width)) (window-width))
(window-width))) (window-width)))
(fill-column (- limit (fill-column (- limit
depth indent
;; 2 to avoid poor interaction with ;; 2 to avoid poor interaction with
;; `word-wrap'. ;; `word-wrap'.
2))) 2)))

View file

@ -109,12 +109,14 @@ http://notmuchmail.org/mailman/listinfo/notmuch
To: notmuch@notmuchmail.org To: notmuch@notmuchmail.org
Date: Wed, 18 Nov 2009 02:50:48 +0600 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 Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at
did gyre and gimble: seas.harvard.edu did gyre and gimble:
LK> Is the list archived anywhere? The obvious archives LK> Is the list archived anywhere? The obvious archives
LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available,
LK> think I subscribed too late to get the patch (I only just saw the and I
LK> think I subscribed too late to get the patch (I only just saw
the
LK> discussion about it). LK> discussion about it).
LK> It doesn't look like the patch is in git yet. 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: seas.harvard.edu> wrote:
> > See the patch just posted here. > > 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 private notmuch repository
git://keithp.com/git/notmuch git://keithp.com/git/notmuch
@ -164,10 +167,12 @@ http://notmuchmail.org/mailman/listinfo/notmuch
[ multipart/signed ] [ multipart/signed ]
[ Unknown signature status ] [ Unknown signature status ]
[ text/plain ] [ 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 > 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). missing "#include <stdint.h>" (for the uint32_t on line 466).
[ 4-line signature. Click/Enter to show. ] [ 4-line signature. Click/Enter to show. ]

View file

@ -49,8 +49,8 @@ Date: Wed, 18 Nov 2009 01:02:38 +0600
[ Unknown signature status ] [ Unknown signature status ]
[ text/plain ] [ text/plain ]
Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did Twas brillig at 14:00:54 17.11.2009 UTC-05 when lars@seas.harvard.edu did gyre
gyre and gimble: and gimble:
LK> Resulted in 4604 lines of errors along the lines of: 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 To: notmuch@notmuchmail.org
Date: Wed, 18 Nov 2009 02:50:48 +0600 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 Twas brillig at 15:33:01 17.11.2009 UTC-05 when lars at seas.harvard.edu did
did gyre and gimble: gyre and gimble:
LK> Is the list archived anywhere? The obvious archives LK> Is the list archived anywhere? The obvious archives
LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I LK> (http://notmuchmail.org/pipermail/notmuch/) aren't available, and I