From 999d473299781cb2a38fba5d9e2452504799a7a2 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sat, 6 Aug 2016 16:29:33 +0100 Subject: [PATCH] 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. --- emacs/notmuch-wash.el | 4 +++- ...-maildir-storage-with-fourfold-indentation | 19 ++++++++++++------- ...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 57e6dfa3..07fc1a1f 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 4721b8b0..3bbb114a 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 " (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 62a46353..620caa00 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