Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 4f / 38002da6b3469d2aeff1fb8b48661699749b97
1 Return-Path: <markwalters1009@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5  by arlo.cworth.org (Postfix) with ESMTP id D11A16DE015B\r
6  for <notmuch@notmuchmail.org>; Wed,  6 Jul 2016 00:47:49 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.344\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.344 tagged_above=-999 required=5 tests=[AWL=0.226,\r
12   DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13  FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,\r
14  RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001]\r
15  autolearn=disabled\r
16 Received: from arlo.cworth.org ([127.0.0.1])\r
17  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
18  with ESMTP id vFn3eykN72WB for <notmuch@notmuchmail.org>;\r
19  Wed,  6 Jul 2016 00:47:41 -0700 (PDT)\r
20 Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com\r
21  [74.125.82.43]) by arlo.cworth.org (Postfix) with ESMTPS id 72F416DE0008 for\r
22  <notmuch@notmuchmail.org>; Wed,  6 Jul 2016 00:47:41 -0700 (PDT)\r
23 Received: by mail-wm0-f43.google.com with SMTP id 187so30870160wmz.1\r
24  for <notmuch@notmuchmail.org>; Wed, 06 Jul 2016 00:47:41 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26  h=from:to:cc:subject:date:message-id;\r
27  bh=ySoBJAQY3xRoYEjVYDISQ//OFXODpaK+fWbYDq5oBRc=;\r
28  b=WRWv5zSqMbfBuUIWm/fzPyikIAxq/hK28l+tJAjetrzrxnMPS1dpeJTrsMfXzoTQTB\r
29  S/k30YKdDFJ8WR5Cv2damxfVTh5XX7m4nNXGqU57cWEwLR/zfuZE5y2MCmVKkY9gdMOS\r
30  ctnhJRo9ViaIX+LAk6MFzOty/PsEtkFyskZiifYyCUD426szddng9VWTEepydFk2n3uh\r
31  KRE4iD+UPFEtv+nxWZ5uI2COMDDj8IhVtt4cFn6n+NsIlZaZ9YLYYFLPFGg7JnDwA4CP\r
32  JSCvsaCRC8orgHHEqKJO0jHiu7Uoi6+z9uS9tSZ4aMNgM388WQSfI/h40Jh5GHMRblaf\r
33  +PWg==\r
34 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
35  d=1e100.net; s=20130820;\r
36  h=x-gm-message-state:from:to:cc:subject:date:message-id;\r
37  bh=ySoBJAQY3xRoYEjVYDISQ//OFXODpaK+fWbYDq5oBRc=;\r
38  b=FqlnI0p91poxPqJdbaO0D0B5EfB+yc+ipXigsvmliqyh5utX+Q4fPHJltlXDLxaDVW\r
39  93GHb2xiz6OrhDeGdOm34YPHHegerEp0LPk2lHuJ/K9wYkKoyV8ykcNFg4ABhtbK8UBX\r
40  HojuDz8hngBtsCZ3K7o3s3xeELv87Lnx4d0wHAo6RsdB1ake8O/mr3gafqpPDgpK9IJv\r
41  oPXb1QtZeBcbtKHY+D/xEOR7VT4kr4v23z6sMvHj2s7Nntrewl2pCuI/9JrDYgYs3EcO\r
42  VcS2IZkJgpsEIt9m5GuxQ1hD6MWYtlOwrM74hYvEkD09IrxL4XPwVaBhOooOZ+gpOcgH\r
43  g+Xg==\r
44 X-Gm-Message-State:\r
45  ALyK8tJ+8WcW0xEzH8IFwJdqvgILgmZzMFI7mepZOo4hP/xagPzkGysescas9gk97nZFdw==\r
46 X-Received: by 10.28.10.196 with SMTP id 187mr20900099wmk.48.1467791259321;\r
47  Wed, 06 Jul 2016 00:47:39 -0700 (PDT)\r
48 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
49  by smtp.gmail.com with ESMTPSA id d4sm882995wjb.47.2016.07.06.00.47.38\r
50  (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
51  Wed, 06 Jul 2016 00:47:38 -0700 (PDT)\r
52 From: Mark Walters <markwalters1009@gmail.com>\r
53 To: notmuch@notmuchmail.org\r
54 Subject: [PATCH] emacs: wash: make word-wrap bound message width\r
55 Date: Wed,  6 Jul 2016 08:47:31 +0100\r
56 Message-Id: <1467791251-6823-1-git-send-email-markwalters1009@gmail.com>\r
57 X-Mailer: git-send-email 2.1.4\r
58 X-BeenThere: notmuch@notmuchmail.org\r
59 X-Mailman-Version: 2.1.20\r
60 Precedence: list\r
61 List-Id: "Use and development of the notmuch mail system."\r
62  <notmuch.notmuchmail.org>\r
63 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
64  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
66 List-Post: <mailto:notmuch@notmuchmail.org>\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
68 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
69  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
70 X-List-Received-Date: Wed, 06 Jul 2016 07:47:50 -0000\r
71 \r
72 Previously if notmuch-wash-wrap-lines-length was set then all messages\r
73 would be wrapped at this value (or window-width if that is\r
74 smaller). This was done regardless of the message's depth in a thread:\r
75 for example, if the n.w.w.l.l is 80 and the messages depth is 20\r
76 (so indented 20 by default) the messages text only got 60 characters\r
77 of space.\r
78 \r
79 This commit changes that so a message always gets the full n.w.w.l.l\r
80 of width regardless of its indentation (unless that goes over\r
81 window-width of course).\r
82 ---\r
83 \r
84 This is what I would like -- I don't know if anyone would like to keep\r
85 the previous behaviour as an option. The code-part for that is easy, but getting\r
86 the docstrings and and defcustoms right is not clear.\r
87 \r
88 Best wishes\r
89 \r
90 Mark\r
91 \r
92 emacs/notmuch-wash.el | 6 +++---\r
93  1 file changed, 3 insertions(+), 3 deletions(-)\r
94 \r
95 diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el\r
96 index 57e6dfa..e16b8cc 100644\r
97 --- a/emacs/notmuch-wash.el\r
98 +++ b/emacs/notmuch-wash.el\r
99 @@ -121,8 +121,8 @@ collapse the remaining lines into a button."\r
100  \r
101  If this is nil, lines in messages will be wrapped to fit in the\r
102  current window. If this is a number, lines will be wrapped after\r
103 -this many characters or at the window width (whichever one is\r
104 -lower)."\r
105 +this many characters (ignoring indentation due to thread depth)\r
106 +or at the window width (whichever one is lower)."\r
107    :type '(choice (const :tag "window width" nil)\r
108                  (integer :tag "number of characters"))\r
109    :group 'notmuch-wash)\r
110 @@ -336,7 +336,7 @@ the wrapped text are maintained."\r
111  \r
112    (let* ((coolj-wrap-follows-window-size nil)\r
113          (limit (if (numberp notmuch-wash-wrap-lines-length)\r
114 -                   (min notmuch-wash-wrap-lines-length\r
115 +                   (min (+ notmuch-wash-wrap-lines-length depth)\r
116                          (window-width))\r
117                   (window-width)))\r
118          (fill-column (- limit\r
119 -- \r
120 2.1.4\r
121 \r