Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / f6 / 0283da725d52ab6da20a3ba1e34e6ae22d3a2b
1 Return-Path: <m.walters@qmul.ac.uk>\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 olra.theworths.org (Postfix) with ESMTP id 258C2431FAF\r
6         for <notmuch@notmuchmail.org>; Tue, 18 Dec 2012 00:54:10 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 1.401\r
10 X-Spam-Level: *\r
11 X-Spam-Status: No, score=1.401 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         FREEMAIL_REPLY=2.499, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3]\r
14         autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id 2W2R3gS7bO2U for <notmuch@notmuchmail.org>;\r
18         Tue, 18 Dec 2012 00:54:08 -0800 (PST)\r
19 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
20         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id 13089431FAE\r
23         for <notmuch@notmuchmail.org>; Tue, 18 Dec 2012 00:54:08 -0800 (PST)\r
24 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
25         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
26         (envelope-from <m.walters@qmul.ac.uk>)\r
27         id 1Tksw8-0004uF-7Y; Tue, 18 Dec 2012 08:54:04 +0000\r
28 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1Tksw7-0004gq-T1; Tue, 18 Dec 2012 08:54:04 +0000\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: notmuch@notmuchmail.org\r
34 Subject: Re: [PATCH v4 0/5] Use invisibility to toggle display of all parts\r
35         including multipart\r
36 In-Reply-To: <1355781287-6010-1-git-send-email-markwalters1009@gmail.com>\r
37 References: <1355781287-6010-1-git-send-email-markwalters1009@gmail.com>\r
38 User-Agent: Notmuch/0.14+236~g1d0044f (http://notmuchmail.org) Emacs/24.2.1\r
39         (x86_64-pc-linux-gnu)\r
40 Date: Tue, 18 Dec 2012 08:54:03 +0000\r
41 Message-ID: <87ip7zu4es.fsf@qmul.ac.uk>\r
42 MIME-Version: 1.0\r
43 Content-Type: text/plain\r
44 X-Sender-Host-Address: 93.97.24.31\r
45 X-QM-SPAM-Info: Sender has good ham record.  :)\r
46 X-QM-Body-MD5: 3c6eba937d4796f95dd81d2e8eb32c68 (of first 20000 bytes)\r
47 X-SpamAssassin-Score: -1.2\r
48 X-SpamAssassin-SpamBar: -\r
49 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
50         determine if it is\r
51         spam. We require at least 5.0 points to mark a message as spam.\r
52         This message scored -1.2 points.\r
53         Summary of the scoring: \r
54         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
55         *      medium trust\r
56         *      [138.37.6.40 listed in list.dnswl.org]\r
57         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
58         provider *      (markwalters1009[at]gmail.com)\r
59         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
60         *      domain\r
61         *  1.0 FREEMAIL_REPLY From and body contain different freemails\r
62         *  0.1 AWL AWL: From: address is in the auto white-list\r
63 X-QM-Scan-Virus: ClamAV says the message is clean\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\r
67 List-Id: "Use and development of the notmuch mail system."\r
68         <notmuch.notmuchmail.org>\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
72 List-Post: <mailto:notmuch@notmuchmail.org>\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
76 X-List-Received-Date: Tue, 18 Dec 2012 08:54:10 -0000\r
77 \r
78 On Mon, 17 Dec 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
79 > This is version 4 of this series (previous version at\r
80 > id:1355559338-14313-1-git-send-email-markwalters1009@gmail.com).\r
81 >\r
82 > The only change should be a bugfix which, for reasons I don't\r
83 > understand, only causes a problem on emacs 24. The problem is that the\r
84 > part invisibility code looks for a part button at the start of the\r
85 > region. This gets confused if there is a part with no part button\r
86 > (this is the case for the first part if it is text/plain) and the part\r
87 > starts with a button (as can happen if the message starts with the\r
88 > reply as in the first test in test/emacs-show).\r
89 >\r
90 > This checks that the button is a part button before creating the part\r
91 > overlay.\r
92 \r
93 I don't think the above is very clear so I will try to explain it more\r
94 fully. \r
95 \r
96 The invisibility overlay for a part needs to be `linked' to the part\r
97 header button so that the part header button can toggle the overlay\r
98 visibility. The overlay is created and linked to this button after the\r
99 whole part has been inserted (including any notmuch-wash stuff). \r
100 \r
101 I could have made insert-part-header return the button it made and pass\r
102 it back up the call chain to the the create-overlays function but\r
103 instead I chose to make create-overlays just take the button at the\r
104 start of the part.\r
105 \r
106 Now if the first part is text/plain then notmuch does not insert a\r
107 [text/plain] button so the code checks for this case by making sure the\r
108 part does start with a button, and if not it does not create the part\r
109 overlay (there is no button to toggle it so no point in an overlay).\r
110 \r
111 However, if the first part is text/plain and notmuch wash happens to\r
112 make a button at the very start of the part then the create-overlays\r
113 function did still create an overlay *and* link it to the button. This\r
114 linking overwrote some of the things notmuch wash had attached to its\r
115 button (eg the button :overlay property) and that caused things to\r
116 break.\r
117 \r
118 I still do not know why emacs 23 and emacs 24 behave differently, but\r
119 regardless the change from v3 is a clear bugfix: we just make sure it is\r
120 a notmuch-show-insert-part-header button not a notmuch-wash button\r
121 before we do the overlay creation/linking to the button. This version\r
122 does that by looking for a :base-label property of the button which\r
123 insert-part-header buttons have but notmuch-wash buttons do\r
124 not. (Obviously there are other ways this check could be done)\r
125 \r
126 Best wishes\r
127 \r
128 Mark\r
129 \r
130 \r
131 \r
132 > The diff is below the diffstat. \r
133 >\r
134 > Best wishes\r
135 >\r
136 > Mark\r
137 >\r
138 >\r
139 >\r
140 > Mark Walters (5):\r
141 >   emacs: show: modify insert-part-header to save the button text\r
142 >   emacs: show: add overlays for each part\r
143 >   emacs: show: add invisibility button action\r
144 >   emacs: wash: fix fake-diff part to include msg parameter\r
145 >   emacs: show: set default show-all-multipart/alternatives to nil\r
146 >\r
147 >  emacs/notmuch-show.el |  115 ++++++++++++++++++++++++++++++++++++++-----------\r
148 >  emacs/notmuch-wash.el |    2 +-\r
149 >  2 files changed, 90 insertions(+), 27 deletions(-)\r
150 >\r
151 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
152 > index 5ca6fe2..3816e32 100644\r
153 > --- a/emacs/notmuch-show.el\r
154 > +++ b/emacs/notmuch-show.el\r
155 > @@ -865,8 +865,10 @@ message at DEPTH in the current thread."\r
156 >    (let* ((button (button-at beg))\r
157 >        (part-beg (and button (1+ (button-end button)))))\r
158 >  \r
159 > -    ;; If the part contains no text we do not make it toggleable.\r
160 > -    (when (and button (/= part-beg end))\r
161 > +    ;; If the part contains no text we do not make it toggleable. We\r
162 > +    ;; also need to check that the button is a genuine part button not\r
163 > +    ;; a notmuch-wash button.\r
164 > +    (when (and button (/= part-beg end) (button-get button :base-label))\r
165 >        (let ((base-label (button-get button :base-label))\r
166 >           (overlay (make-overlay part-beg end))\r
167 >           (message-invis-spec (plist-get msg :message-invis-spec))\r
168 > -- \r
169 > 1.7.9.1\r