Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / a0 / e83f86f26b890fe29ea1f8263df98f7df9f4a8
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 1BCF1429E54\r
6         for <notmuch@notmuchmail.org>; Sat,  1 Jun 2013 09:46:43 -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: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id JqxFqtMLhy-d for <notmuch@notmuchmail.org>;\r
17         Sat,  1 Jun 2013 09:46:35 -0700 (PDT)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 73550431FDE\r
22         for <notmuch@notmuchmail.org>; Sat,  1 Jun 2013 09:46:35 -0700 (PDT)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1Uiowp-0003YR-D8; Sat, 01 Jun 2013 17:46:31 +0100\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
28         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
29         (envelope-from <m.walters@qmul.ac.uk>)\r
30         id 1Uiowp-0002l1-0a; Sat, 01 Jun 2013 17:46:31 +0100\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: notmuch@notmuchmail.org, Austin Clements <aclements@csail.mit.edu>,\r
33         Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
34 Subject: [PATCH v4 6/5] emacs: show: lazy-part bugfix\r
35 In-Reply-To: <1370074547-24677-1-git-send-email-markwalters1009@gmail.com>\r
36 References: <1370074547-24677-1-git-send-email-markwalters1009@gmail.com>\r
37 User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1\r
38         (x86_64-pc-linux-gnu)\r
39 Date: Sat, 01 Jun 2013 17:46:30 +0100\r
40 Message-ID: <87mwr97p95.fsf@qmul.ac.uk>\r
41 MIME-Version: 1.0\r
42 Content-Type: text/plain; charset=us-ascii\r
43 X-Sender-Host-Address: 93.97.24.31\r
44 X-QM-SPAM-Info: Sender has good ham record.  :)\r
45 X-QM-Body-MD5: 85f0f0cd402e6c847b54dfbcd16b6564 (of first 20000 bytes)\r
46 X-SpamAssassin-Score: -0.1\r
47 X-SpamAssassin-SpamBar: /\r
48 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
49         determine if it is\r
50         spam. We require at least 5.0 points to mark a message as spam.\r
51         This message scored -0.1 points.\r
52         Summary of the scoring: \r
53         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
54         provider *      (markwalters1009[at]gmail.com)\r
55         * -0.1 AWL AWL: From: address is in the auto white-list\r
56 X-QM-Scan-Virus: ClamAV says the message is clean\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Sat, 01 Jun 2013 16:46:43 -0000\r
70 \r
71 \r
72 Previously we inserted the lazy part at the start of the line after\r
73 the part button. But if this line had some text properties (e.g. the\r
74 colours for a following message header) then the lazy part gets these\r
75 properties. Thus we start at the end of the part button line, insert a\r
76 newline, insert the lazy part, and then delete the extra newline at the end of\r
77 the part.\r
78 ---\r
79 \r
80 I found a bug in the lazy-part patch set (v4): the problem can be seen\r
81 if you find a multipart/alternative text/plain text/html message with a\r
82 reply following it. Before this extra patch the lazy-part gets inserted\r
83 with the wrong text properties: in particular it gets the special\r
84 background colour that the headerline of a message gets in the show\r
85 view. I think this was why I had the "lazy part" text before but this is\r
86 probably better. \r
87 \r
88 I can fold this into the main series but I thought I would ask for\r
89 comments on this change first.\r
90 \r
91 Best wishes\r
92 \r
93 Mark\r
94  \r
95 \r
96 \r
97  emacs/notmuch-show.el |   12 ++++++++++--\r
98  1 files changed, 10 insertions(+), 2 deletions(-)\r
99 \r
100 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
101 index 92f481b..453ff54 100644\r
102 --- a/emacs/notmuch-show.el\r
103 +++ b/emacs/notmuch-show.el\r
104 @@ -818,9 +818,15 @@ message at DEPTH in the current thread."\r
105      t))\r
106  \r
107  (defun notmuch-show-lazy-part (part-args button)\r
108 -  ;; Insert the lazy part after the button for the part.\r
109 +  ;; Insert the lazy part after the button for the part. We would just\r
110 +  ;; move to the start of the new line following the button and insert\r
111 +  ;; the part but that point might have text properties (eg colours\r
112 +  ;; from a message header etc) so instead we start from the last\r
113 +  ;; character of the button by adding a newline and finish by\r
114 +  ;; removing the extra newline from the end of the part.\r
115    (save-excursion\r
116 -    (goto-char (1+ (button-end button)))\r
117 +    (goto-char (button-end button))\r
118 +    (insert "\n")\r
119      (let* ((inhibit-read-only t)\r
120            ;; We need to use markers for the start and end of the part\r
121            ;; because the part insertion functions do not guarantee\r
122 @@ -835,6 +841,8 @@ message at DEPTH in the current thread."\r
123         (delete-region part-beg part-end)\r
124         (apply #'notmuch-show-insert-bodypart-internal part-args)\r
125         (indent-rigidly part-beg part-end depth))\r
126 +      (goto-char part-end)\r
127 +      (delete-char 1)\r
128        ;; Create the overlay. If the lazy-part turned out to be empty/not\r
129        ;; showable this returns nil.\r
130        (notmuch-show-create-part-overlays button part-beg part-end))))\r
131 -- \r
132 1.7.9.1\r
133 \r
134 \r
135 \r