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 1B3AD431FD0
\r
6 for <notmuch@notmuchmail.org>; Fri, 31 May 2013 16:09:01 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 BuW8kvcvPZGA for <notmuch@notmuchmail.org>;
\r
17 Fri, 31 May 2013 16:08:55 -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 02CED431FBD
\r
22 for <notmuch@notmuchmail.org>; Fri, 31 May 2013 16:08:55 -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 1UiYRD-00073D-O5; Sat, 01 Jun 2013 00:08:53 +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 1UiYRD-0002DF-EM; Sat, 01 Jun 2013 00:08:47 +0100
\r
31 From: Mark Walters <markwalters1009@gmail.com>
\r
32 To: Austin Clements <aclements@csail.mit.edu>, notmuch@notmuchmail.org,
\r
33 Adam Wolfe Gordon <awg+notmuch@xvx.ca>
\r
34 Subject: Re: [PATCH v3 3/5] emacs: show: pass button to create-overlays
\r
35 In-Reply-To: <874ndi3gd7.fsf@awakening.csail.mit.edu>
\r
36 References: <1370024806-6616-1-git-send-email-markwalters1009@gmail.com>
\r
37 <1370024806-6616-4-git-send-email-markwalters1009@gmail.com>
\r
38 <874ndi3gd7.fsf@awakening.csail.mit.edu>
\r
39 User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1
\r
41 Date: Sat, 01 Jun 2013 00:08:46 +0100
\r
42 Message-ID: <87vc5yg329.fsf@qmul.ac.uk>
\r
44 Content-Type: text/plain; charset=us-ascii
\r
45 X-Sender-Host-Address: 93.97.24.31
\r
46 X-QM-SPAM-Info: Sender has good ham record. :)
\r
47 X-QM-Body-MD5: b6e91ab99d81b99d8f76102b1756fd01 (of first 20000 bytes)
\r
48 X-SpamAssassin-Score: -0.1
\r
49 X-SpamAssassin-SpamBar: /
\r
50 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
52 spam. We require at least 5.0 points to mark a message as spam.
\r
53 This message scored -0.1 points.
\r
54 Summary of the scoring:
\r
55 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
56 provider * (markwalters1009[at]gmail.com)
\r
57 * -0.1 AWL AWL: From: address is in the auto white-list
\r
58 X-QM-Scan-Virus: ClamAV says the message is clean
\r
59 X-BeenThere: notmuch@notmuchmail.org
\r
60 X-Mailman-Version: 2.1.13
\r
62 List-Id: "Use and development of the notmuch mail system."
\r
63 <notmuch.notmuchmail.org>
\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
67 List-Post: <mailto:notmuch@notmuchmail.org>
\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
71 X-List-Received-Date: Fri, 31 May 2013 23:09:01 -0000
\r
74 > On Fri, 31 May 2013, Mark Walters <markwalters1009@gmail.com> wrote:
\r
75 >> Now that the bodypart code has the button we can pass that to
\r
76 >> create-overlays and simplify that.
\r
78 >> emacs/notmuch-show.el | 26 ++++++++++++--------------
\r
79 >> 1 file changed, 12 insertions(+), 14 deletions(-)
\r
81 >> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
82 >> index be3aeac..66cc3a5 100644
\r
83 >> --- a/emacs/notmuch-show.el
\r
84 >> +++ b/emacs/notmuch-show.el
\r
85 >> @@ -851,21 +851,19 @@ message at DEPTH in the current thread."
\r
86 >> (setq handlers (cdr handlers))))
\r
89 >> -(defun notmuch-show-create-part-overlays (msg beg end hide)
\r
90 >> +(defun notmuch-show-create-part-overlays (button beg end hide)
\r
91 >> "Add an overlay to the part between BEG and END"
\r
92 >> - (let* ((button (button-at beg))
\r
93 >> - (part-beg (and button (1+ (button-end button)))))
\r
95 >> - ;; If the part contains no text we do not make it toggleable. We
\r
96 >> - ;; also need to check that the button is a genuine part button not
\r
97 >> - ;; a notmuch-wash button.
\r
98 >> - (when (and button (/= part-beg end) (button-get button :base-label))
\r
99 >> - (button-put button 'overlay (make-overlay part-beg end))
\r
100 >> - ;; We toggle the button for hidden parts as that gets the
\r
102 >> + ;; If there is no button (i.e., the part is text/plain and the first
\r
103 >> + ;; part) or if the part has no content then we don't make the part
\r
104 >> + ;; toggleable.
\r
105 >> + (when (and button (/= beg end))
\r
106 >> + (button-put button 'overlay (make-overlay beg end))
\r
107 >> + ;; We toggle the button for hidden parts as that gets the
\r
108 >> ;; button label right.
\r
111 >> - (notmuch-show-toggle-part-invisibility button))))))
\r
112 >> + (notmuch-show-toggle-part-invisibility button)))))
\r
114 > I might just be mis-following the diff here, but shouldn't the above get
\r
117 I think you are right: it got a bit messed up when I tried to split up
\r
118 the patch. I don't think it matters much as these lines get deleted in
\r
119 the next patch. Incidentally is there a good git work flow for fixing up
\r
120 something like this where you just want to change the midpoint of a
\r
125 >> (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
\r
126 >> "Insert the body part PART at depth DEPTH in the current thread.
\r
127 >> @@ -879,10 +877,10 @@ If HIDE is non-nil then initially hide this part."
\r
130 >> (nth (plist-get part :id))
\r
132 >> ;; We omit the part button for the first (or only) part if this is text/plain.
\r
133 >> (button (unless (and (string= mime-type "text/plain") (<= nth 1))
\r
134 >> - (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename)))))
\r
135 >> + (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
\r
136 >> + (beg (point)))
\r
138 > Was this swap necessary?
\r
140 This is needed: inserting a part header moves point and this means that
\r
141 point is at the start of the part content rather than the start of the
\r
150 >> (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)
\r
151 >> ;; Some of the body part handlers leave point somewhere up in the
\r
152 >> @@ -891,7 +889,7 @@ If HIDE is non-nil then initially hide this part."
\r
153 >> ;; Ensure that the part ends with a carriage return.
\r
156 >> - (notmuch-show-create-part-overlays msg beg (point) hide)))
\r
157 >> + (notmuch-show-create-part-overlays button beg (point) hide)))
\r
159 >> (defun notmuch-show-insert-body (msg body depth)
\r
160 >> "Insert the body BODY at depth DEPTH in the current thread."
\r