Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 41 / 8fdb48e785577e44333ed0c5eab99e75d6ab3e
1 Return-Path: <amdragon@mit.edu>\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 31D3F429E38\r
6         for <notmuch@notmuchmail.org>; Wed,  4 Sep 2013 07:56:54 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id t4IG10QYpxsx for <notmuch@notmuchmail.org>;\r
16         Wed,  4 Sep 2013 07:56:47 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-5.mit.edu (dmz-mailsec-scanner-5.mit.edu\r
18         [18.7.68.34])\r
19         by olra.theworths.org (Postfix) with ESMTP id 38823429E37\r
20         for <notmuch@notmuchmail.org>; Wed,  4 Sep 2013 07:56:47 -0700 (PDT)\r
21 X-AuditID: 12074422-b7ef78e000000935-84-52274a2dbe20\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 8B.54.02357.D2A47225; Wed,  4 Sep 2013 10:56:45 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r84EuiDg020311; \r
27         Wed, 4 Sep 2013 10:56:45 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r84EufQ7025327\r
32         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
33         Wed, 4 Sep 2013 10:56:43 -0400\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1VHEVc-00055T-Op; Wed, 04 Sep 2013 10:56:41 -0400\r
37 Date: Wed, 4 Sep 2013 10:56:39 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Mark Walters <markwalters1009@gmail.com>\r
40 Subject: Re: [PATCH v2] emacs: show: lazy part bugfix\r
41 Message-ID: <20130904145639.GB1426@mit.edu>\r
42 References: <1377246875-7784-1-git-send-email-markwalters1009@gmail.com>\r
43         <1378279835-28288-1-git-send-email-markwalters1009@gmail.com>\r
44 MIME-Version: 1.0\r
45 Content-Type: text/plain; charset=us-ascii\r
46 Content-Disposition: inline\r
47 In-Reply-To: <1378279835-28288-1-git-send-email-markwalters1009@gmail.com>\r
48 User-Agent: Mutt/1.5.21 (2010-09-15)\r
49 X-Brightmail-Tracker:\r
50  H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IRYrdT19X1Ug8yWNyiYrF6Lo/F9ZszmR2Y\r
51         PHbOusvu8WzVLeYApigum5TUnMyy1CJ9uwSujGNNC9kLPslWnF9V0MB4TbyLkZNDQsBEYt/6\r
52         WewQtpjEhXvr2boYuTiEBPYxSvx8NYcJwtnAKHH1TBs7hHOKSeJS63kWCGcJo8Spxplg/SwC\r
53         KhK7u3qYQGw2AQ2JbfuXM4LYIgI6ErcPLQCrYRaQlvj2uxmsRljAVGL1xDNgcV4BbYlP87ug\r
54         1nUwSkxas54VIiEocXLmExaIZi2JG/9eAhVxgA1a/o8DJMwp4CXxdmYTG4gtCnTDlJPb2CYw\r
55         Cs1C0j0LSfcshO4FjMyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdE31cjNL9FJTSjcxgsPaRWkH\r
56         48+DSocYBTgYlXh4NQ3Vg4RYE8uKK3MPMUpyMCmJ8urZAIX4kvJTKjMSizPii0pzUosPMUpw\r
57         MCuJ8E51BsrxpiRWVqUW5cOkpDlYlMR5nz09GygkkJ5YkpqdmlqQWgSTleHgUJLgLfIEahQs\r
58         Sk1PrUjLzClBSDNxcIIM5wEa7gRSw1tckJhbnJkOkT/FqCglzusCkhAASWSU5sH1wtLOK0Zx\r
59         oFeEIap4gCkLrvsV0GAmoMFpn1VBBpckIqSkGhjjfsvK/bPc+/+CcYjoFfWMdY3fLVoPPDhg\r
60         sO/Q2ZMux0RXSG30PBn4YK/8wsJ7KcGzt3tvv7k20TGp66mpP8v/wOQrHcGftrxkTnDdxr//\r
61         vbFMhU61ZEbqRLbw2/HLXVONzA9yn7ryTDfw5uzgObrnBdhq56+c1PJh4TIW9jI1vjNpk2fr\r
62         8GUrsRRnJBpqMRcVJwIA4U4JKxYDAAA=\r
63 Cc: notmuch@notmuchmail.org\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: Wed, 04 Sep 2013 14:56:54 -0000\r
77 \r
78 Quoth Mark Walters on Sep 04 at  8:30 am:\r
79 > The lazy part handling had a subtle bug. Notmuch stores the part\r
80 > information as a text property with the displayed part so attachment\r
81 > handling (saving viewing etc work).\r
82 \r
83 s/ work)/) work/\r
84 \r
85\r
86 > Now, some mime parts have subparts and to avoid overwriting the\r
87 > sub-part data notmuch checks and if part data is already recorded it\r
88 > does not overwrite it.\r
89\r
90 > Now with lazy part handling this could fail: there is already part\r
91 > data stored. In the common case it works as the part type information\r
92 > was stored when the lazy-part button was inserted. However, this fails\r
93 > if the lazy part has sub-parts: notmuch had no idea these existed\r
94 > until the lazy part insertion.\r
95 \r
96 This says that things fail when a lazy part has sub-parts, but not\r
97 what the failure is.  What is the failure?  Can you give a specific\r
98 sequence of events and conditions that leads to and demonstrates the\r
99 failure?\r
100 \r
101 (I ask not just for commit posterity, but because I actually don't\r
102 know, though I may have figured it out after writing the comment\r
103 below.)\r
104 \r
105 > We fix this by removing any existing part-information from the\r
106 > relevant region before doing the lazy insertion.\r
107 > ---\r
108 > This is the same as the previous patch\r
109 > id:1377246875-7784-1-git-send-email-markwalters1009@gmail.com except I\r
110 > have added a substantial comment. I now believe the +1 in the remove\r
111 > part information is genuinely correct for the reason detailed in the comment.\r
112 >  \r
113 > This does seem to fix an actual bug (see parent message and links there).\r
114\r
115 > Best wishes\r
116\r
117 > Mark\r
118\r
119\r
120 >  emacs/notmuch-show.el |   13 +++++++++++++\r
121 >  1 files changed, 13 insertions(+), 0 deletions(-)\r
122\r
123 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
124 > index 20844f0..58ef4df 100644\r
125 > --- a/emacs/notmuch-show.el\r
126 > +++ b/emacs/notmuch-show.el\r
127 > @@ -852,7 +852,20 @@ message at DEPTH in the current thread."\r
128 >    ;; from a message header etc) so instead we start from the last\r
129 >    ;; character of the button by adding a newline and finish by\r
130 >    ;; removing the extra newline from the end of the part.\r
131 > +  ;;\r
132 > +  ;; Essentially, this function wants text properties to be\r
133 > +  ;; front-nonsticky (where most of the other functions need\r
134 > +  ;; front-sticky so that is what they actually are) and this is a way\r
135 > +  ;; of faking the front-nonsticky for this one function.\r
136 \r
137 Most properties are rear-sticky and front-nonsticky.  Maybe this is\r
138 referring specifically to :notmuch-part, which is the other way\r
139 around?\r
140 \r
141 > +  ;;\r
142 > +  ;; For exactly this reason we also remove existing part-information\r
143 > +  ;; from one extra character: this extra character is the newline\r
144 > +  ;; that we delete at the end.\r
145 \r
146 This comment doesn't say what the root of the problem is.  Is the\r
147 following accurate?\r
148 \r
149 ;; First, eliminate the :notmuch-part property from the region we'll\r
150 ;; be inserting this part in, since we never override an existing\r
151 ;; :notmuch-part property.  If we're inserting a leaf part, it will\r
152 ;; re-apply the same :notmuch-part, but if this isn't a leaf, the\r
153 ;; children need to apply different :notmuch-part values.\r
154 ;; :notmuch-part was originally applied to the newline following the\r
155 ;; button as well, so remove it from that character, too.  (If we\r
156 ;; didn't remove it from the newline, this would all be for naught:\r
157 ;; :notmuch-part is front-sticky and we insert the part immediately\r
158 ;; before this newline, so the part would inherit :notmuch-part from\r
159 ;; the newline.)\r
160 \r
161 > +\r
162 >    (save-excursion\r
163 > +    ;; Remove part-information from lazy part-region\r
164 > +    (put-text-property (button-start button) (1+ (button-end button)) :notmuch-part nil)\r
165 > +\r
166 >      (goto-char (button-end button))\r
167 >      (insert "\n")\r
168 >      (let* ((inhibit-read-only t)\r