1 Return-Path: <dme@dme.org>
\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 148C6431FC2
\r
6 for <notmuch@notmuchmail.org>; Tue, 13 May 2014 02:47:39 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 6XUKKKV6R7SJ for <notmuch@notmuchmail.org>;
\r
16 Tue, 13 May 2014 02:47:31 -0700 (PDT)
\r
17 Received: from mail-we0-f182.google.com (mail-we0-f182.google.com
\r
18 [74.125.82.182]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 04DE0431FAF
\r
21 for <notmuch@notmuchmail.org>; Tue, 13 May 2014 02:47:30 -0700 (PDT)
\r
22 Received: by mail-we0-f182.google.com with SMTP id t60so101544wes.13
\r
23 for <notmuch@notmuchmail.org>; Tue, 13 May 2014 02:47:29 -0700 (PDT)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=1e100.net; s=20130820;
\r
26 h=x-gm-message-state:to:subject:in-reply-to:references:user-agent
\r
27 :from:date:message-id:mime-version:content-type;
\r
28 bh=jyF/oyfkO3Mt9YqRzy/YRokhBC640rN/sFam1lOU0Lk=;
\r
29 b=EOvlTNb3rAyHE3oJTPh499njLAxRIfIkQEPKIIly5dT+j1fVLt3hiaj9oKTBlXFosS
\r
30 tapmJENGrU4tmO5HfU/rOljl6V952rHINNVjoROFNDXkOTP4Hs1Jnn+HuyZB48Gr1qmU
\r
31 bzAmOslQCueW4KjlZzwkacXnCNlpwdPC5j1Fs0qhws3hW9ETMy9q28iSM5kYzbjiHbRF
\r
32 vlsOhb7QwxDmG3WkgEl5BOpf41mbpH2Lcx19yFslmD85CfamZ65drSB8/m6d9Byg+bWO
\r
33 8vkGK/poQ2By9YYa1fM3u1NeyCIuSOATDvprdCEXDtPlSp8lb6bxCx3DKGKzTe0Ga6B3
\r
36 ALoCoQmZRNXPlNq/Jua4Cd3MCtrVVbqU0058oVRruW14T6MWvoN4UWFP3ZdpO+jRwImmS7I9gYAz
\r
37 X-Received: by 10.195.13.76 with SMTP id ew12mr702135wjd.80.1399974449609;
\r
38 Tue, 13 May 2014 02:47:29 -0700 (PDT)
\r
39 Received: from localhost ([2a01:348:1a2:1:a288:b4ff:fe8a:77d8])
\r
40 by mx.google.com with ESMTPSA id 12sm21512017wju.48.2014.05.13.02.47.27
\r
41 for <multiple recipients>
\r
42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
43 Tue, 13 May 2014 02:47:28 -0700 (PDT)
\r
44 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
45 Subject: Re: [PATCH v3 1/9] emacs/show: Re-arrange determination if a part
\r
47 In-Reply-To: <87sioek5sz.fsf@qmul.ac.uk>
\r
48 References: <87sixdujkv.fsf@qmul.ac.uk>
\r
49 <1399897769-26809-1-git-send-email-dme@dme.org>
\r
50 <1399897769-26809-2-git-send-email-dme@dme.org>
\r
51 <87sioek5sz.fsf@qmul.ac.uk>
\r
52 User-Agent: Notmuch/0.18 (http://notmuchmail.org) Emacs/24.3.1
\r
53 (x86_64-pc-linux-gnu)
\r
54 From: David Edmondson <dme@dme.org>
\r
55 Date: Tue, 13 May 2014 10:47:22 +0100
\r
56 Message-ID: <cun1tvy6mdx.fsf@hotblack-desiato.hh.sledj.net>
\r
58 Content-Type: multipart/signed; boundary="=-=-=";
\r
59 micalg=pgp-sha1; protocol="application/pgp-signature"
\r
60 X-BeenThere: notmuch@notmuchmail.org
\r
61 X-Mailman-Version: 2.1.13
\r
63 List-Id: "Use and development of the notmuch mail system."
\r
64 <notmuch.notmuchmail.org>
\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
68 List-Post: <mailto:notmuch@notmuchmail.org>
\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
72 X-List-Received-Date: Tue, 13 May 2014 09:47:39 -0000
\r
75 Content-Type: text/plain
\r
76 Content-Transfer-Encoding: quoted-printable
\r
78 On Mon, May 12 2014, Mark Walters wrote:
\r
79 > On Mon, 12 May 2014, David Edmondson <dme@dme.org> wrote:
\r
80 >> Move the determination of whether a part header is required to a
\r
81 >> distinct function.
\r
83 >> emacs/notmuch-show.el | 25 ++++++++++++++++++-------
\r
84 >> 1 file changed, 18 insertions(+), 7 deletions(-)
\r
86 >> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
87 >> index 10fc872..ec99141 100644
\r
88 >> --- a/emacs/notmuch-show.el
\r
89 >> +++ b/emacs/notmuch-show.el
\r
90 >> @@ -871,6 +871,21 @@ message at DEPTH in the current thread."
\r
91 >> ;; showable this returns nil.
\r
92 >> (notmuch-show-create-part-overlays button part-beg part-end))))
\r
94 >> +(defun notmuch-show-mime-type (part)
\r
95 >> + "Return the correct mime-type to use for PART."
\r
96 >> + (let ((content-type (downcase (plist-get part :content-type))))
\r
97 >> + (or (and (string=3D content-type "application/octet-stream")
\r
98 >> + (notmuch-show-get-mime-type-of-application/octet-stream part))
\r
99 >> + (and (string=3D content-type "inline patch")
\r
100 >> + "text/x-diff")
\r
101 >> + content-type)))
\r
103 >> +(defun notmuch-show-insert-header-p (part)
\r
104 >> + "Return non-NIL if a header button should be inserted for this part."
\r
105 >> + (let ((mime-type (notmuch-show-mime-type part)))
\r
106 >> + (not (and (string=3D mime-type "text/plain")
\r
107 >> + (<=3D (plist-get part :id) 1)))))
\r
109 > My only query here is whether a notmuch-show-hide-header-p (part) might
\r
110 > make some of the logic clearer?
\r
112 You're suggesting to simply invert the sense of the function?
\r
118 >> (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
\r
119 >> "Insert the body part PART at depth DEPTH in the current thread.
\r
121 >> @@ -881,19 +896,15 @@ is t, hide the part initially and show the button.=
\r
123 >> useful for quoting in replies)."
\r
125 >> (let* ((content-type (downcase (plist-get part :content-type)))
\r
126 >> - (mime-type (or (and (string=3D content-type "application/octet-stream=
\r
128 >> - (notmuch-show-get-mime-type-of-application/octet-stream part))
\r
129 >> - (and (string=3D content-type "inline patch")
\r
130 >> - "text/x-diff")
\r
131 >> - content-type))
\r
132 >> + (mime-type (notmuch-show-mime-type part))
\r
133 >> (nth (plist-get part :id))
\r
135 >> ;; Hide the part initially if HIDE is t.
\r
136 >> (show-part (not (equal hide t)))
\r
137 >> ;; We omit the part button for the first (or only) part if
\r
138 >> ;; this is text/plain, or HIDE is 'no-buttons.
\r
139 >> - (button (unless (or (equal hide 'no-buttons)
\r
140 >> - (and (string=3D mime-type "text/plain") (<=3D nth 1)))
\r
141 >> + (button (when (and (not (equal hide 'no-buttons))
\r
142 >> + (notmuch-show-insert-header-p part))
\r
143 >> (notmuch-show-insert-part-header nth mime-type content-type (plist=
\r
144 -get part :filename))))
\r
145 >> (content-beg (point)))
\r
150 >> _______________________________________________
\r
151 >> notmuch mailing list
\r
152 >> notmuch@notmuchmail.org
\r
153 >> http://notmuchmail.org/mailman/listinfo/notmuch
\r
156 Content-Type: application/pgp-signature; name="signature.asc"
\r
158 -----BEGIN PGP SIGNATURE-----
\r
161 iKYEARECAGYFAlNx6ipfFIAAAAAALgAoaXNzdWVyLWZwckBub3RhdGlvbnMub3Bl
\r
162 bnBncC5maWZ0aGhvcnNlbWFuLm5ldDc1M0Y5NDJDMEExNjc3MDE4OURGMUYyMDY5
\r
163 RUNEMEFCRjA0OTY1MTYACgkQaezQq/BJZRbHVQCffqqBuh+DKGalBH+hmacDsjjj
\r
164 UGYAoIwEjXh00e/UYzPKaasGd8A+NDWg
\r
166 -----END PGP SIGNATURE-----
\r