Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 5a / fc50425095eab0b8bd545fa8b8322d0fe9181f
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 olra.theworths.org (Postfix) with ESMTP id 5F7E9431FD5\r
6         for <notmuch@notmuchmail.org>; Fri, 23 Aug 2013 01:34:47 -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.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] 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 c+8zUFvkLPKQ for <notmuch@notmuchmail.org>;\r
18         Fri, 23 Aug 2013 01:34:43 -0700 (PDT)\r
19 Received: from mail-we0-f180.google.com (mail-we0-f180.google.com\r
20         [74.125.82.180]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id D26D6431FAE\r
23         for <notmuch@notmuchmail.org>; Fri, 23 Aug 2013 01:34:42 -0700 (PDT)\r
24 Received: by mail-we0-f180.google.com with SMTP id q58so258512wes.25\r
25         for <notmuch@notmuchmail.org>; Fri, 23 Aug 2013 01:34:40 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id;\r
28         bh=JKJgzo4Y18lFRdP5oIUpYWjBXd/CKkcPmKWGmURZ3tw=;\r
29         b=mRtU0J0KwZX2b26XsBWUrx/Z7aucOu4EL/ddjrda7Xfr8bQP+WsyhKWhzD/HbtzMjk\r
30         Nb2tiv6mwrlKnWvGRifJgl3PE9A0m+1k9957qZ627b2zq+yDISfMPwf9+bg7+ah8/esR\r
31         /GylGwI8LUv3wBHJ3hjxRTkI5I9kwqybMxIf3doQZaBY1xnGdSbODzQ0dSaxT1/Jcr/k\r
32         hd5eC+CprucLiruVXzu1KxiOUGzKJ6FOa+4vApEhUfZsIZsKBcu+3V2JjFvIKDBX6nIN\r
33         8wjePBTdJ3RJWEO/FPUFGYdcMPEKTWk1eS+QqPr9WdfUDTsR9D/bAgDW1A4KXYT4MTtM\r
34         NdxQ==\r
35 X-Received: by 10.180.184.84 with SMTP id es20mr1266534wic.37.1377246879165;\r
36         Fri, 23 Aug 2013 01:34:39 -0700 (PDT)\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
38         by mx.google.com with ESMTPSA id ei6sm2045104wid.11.1969.12.31.16.00.00\r
39         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
40         Fri, 23 Aug 2013 01:34:38 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org,\r
43         amdragon@MIT.EDU\r
44 Subject: [PATCH] emacs: show: lazy part bugfix\r
45 Date: Fri, 23 Aug 2013 09:34:35 +0100\r
46 Message-Id: <1377246875-7784-1-git-send-email-markwalters1009@gmail.com>\r
47 X-Mailer: git-send-email 1.7.9.1\r
48 X-BeenThere: notmuch@notmuchmail.org\r
49 X-Mailman-Version: 2.1.13\r
50 Precedence: list\r
51 List-Id: "Use and development of the notmuch mail system."\r
52         <notmuch.notmuchmail.org>\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
56 List-Post: <mailto:notmuch@notmuchmail.org>\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
60 X-List-Received-Date: Fri, 23 Aug 2013 08:34:47 -0000\r
61 \r
62 The lazy part handling had a subtle bug. Notmuch stores the part\r
63 information as a text property with the displayed part so attachment\r
64 handling (saving viewing etc work).\r
65 \r
66 Now, some mime parts have subparts and to avoid overwriting the\r
67 sub-part data notmuch checks and if part data is already recorded it\r
68 does not overwrite it.\r
69 \r
70 Now with lazy part handling this could fail: there is already part\r
71 data stored. In the common case it works as the part type information\r
72 was stored when the lazy-part button was inserted. However, this fails\r
73 if the lazy part has sub-parts: notmuch had no idea these existed\r
74 until the lazy part insertion.\r
75 \r
76 We fix this by removing any existing part-information from the\r
77 relevant region before doing the lazy insertion.\r
78 ---\r
79 This was shown up by Istvan's patch in id:m3r4dtgz9k.fsf@zsu.kismala.com and \r
80 the bug found by Jamie in id:87fvu4fl25.fsf@servo.finestructure.net\r
81 \r
82 I think this is essentially the right patch: I am not certain about\r
83 the +1 in the removing the property. It seems to be needed but maybe\r
84 something with front/back sticky would be better.\r
85 \r
86 Also this definitely needs more testing before going into master: this\r
87 code is definitely fragile.\r
88 \r
89 Best wishes \r
90 \r
91 Mark\r
92 \r
93  emacs/notmuch-show.el |    3 +++\r
94  1 files changed, 3 insertions(+), 0 deletions(-)\r
95 \r
96 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
97 index 20844f0..a31b6dc 100644\r
98 --- a/emacs/notmuch-show.el\r
99 +++ b/emacs/notmuch-show.el\r
100 @@ -853,6 +853,9 @@ message at DEPTH in the current thread."\r
101    ;; character of the button by adding a newline and finish by\r
102    ;; removing the extra newline from the end of the part.\r
103    (save-excursion\r
104 +    ;; Remove part-information from lazy part-region\r
105 +    (put-text-property (button-start button) (1+ (button-end button)) :notmuch-part nil)\r
106 +\r
107      (goto-char (button-end button))\r
108      (insert "\n")\r
109      (let* ((inhibit-read-only t)\r
110 -- \r
111 1.7.9.1\r
112 \r