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 09A47431FC2
\r
6 for <notmuch@notmuchmail.org>; Mon, 12 May 2014 15:09:44 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 i-4cPO4TtzHM for <notmuch@notmuchmail.org>;
\r
18 Mon, 12 May 2014 15:09:38 -0700 (PDT)
\r
19 Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com
\r
20 [209.85.212.179]) (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 13235431FAF
\r
23 for <notmuch@notmuchmail.org>; Mon, 12 May 2014 15:09:37 -0700 (PDT)
\r
24 Received: by mail-wi0-f179.google.com with SMTP id bs8so5295556wib.0
\r
25 for <notmuch@notmuchmail.org>; Mon, 12 May 2014 15:09:35 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:subject:in-reply-to:references:user-agent:date:message-id
\r
28 :mime-version:content-type;
\r
29 bh=9v5pVKRXzGjfLG7NDUBE5FhJWbb3xKQXVRIAz1xk1iw=;
\r
30 b=uiCzT+f7pnsCKTHrZTf14XtCFCyJbsO+MjnXfsZvSW76rNlbdBFbND047C/bxFBNpk
\r
31 4AAjpvqbdY5KRPeRbPa3Wq33gl1th2DSJR4jIo07/t5DFMNJp0n/xZZ1QvFEbDFzDayA
\r
32 DKWLEyKicQXY5pJzNr11t/fTv4WkSNeDtaJ7JN50eS/IuqsIP6G9p4aYG85327ALZ8Sm
\r
33 470MKlO04xuWZx0e5W7Oni2ZmW4AOilE0IbHtRXgcvgLTP10Hlebtjd3shonh9w3VdE/
\r
34 5dl99w+SspXLnW2M4tSZ0SbQ6ecriRgA9y9VCKePOum9jkRXS6oYjdnLrbMMy9irQcIr
\r
36 X-Received: by 10.180.106.194 with SMTP id gw2mr17795045wib.47.1399932575656;
\r
37 Mon, 12 May 2014 15:09:35 -0700 (PDT)
\r
38 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])
\r
39 by mx.google.com with ESMTPSA id em5sm8590044wic.23.2014.05.12.15.09.34
\r
40 for <multiple recipients>
\r
41 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
42 Mon, 12 May 2014 15:09:35 -0700 (PDT)
\r
43 From: Mark Walters <markwalters1009@gmail.com>
\r
44 To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org
\r
45 Subject: Re: [PATCH v3 1/9] emacs/show: Re-arrange determination if a part
\r
47 In-Reply-To: <1399897769-26809-2-git-send-email-dme@dme.org>
\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 User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1
\r
52 (x86_64-pc-linux-gnu)
\r
53 Date: Mon, 12 May 2014 23:09:32 +0100
\r
54 Message-ID: <87sioek5sz.fsf@qmul.ac.uk>
\r
56 Content-Type: text/plain; charset=us-ascii
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\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: Mon, 12 May 2014 22:09:44 -0000
\r
72 On Mon, 12 May 2014, David Edmondson <dme@dme.org> wrote:
\r
73 > Move the determination of whether a part header is required to a
\r
74 > distinct function.
\r
76 > emacs/notmuch-show.el | 25 ++++++++++++++++++-------
\r
77 > 1 file changed, 18 insertions(+), 7 deletions(-)
\r
79 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
80 > index 10fc872..ec99141 100644
\r
81 > --- a/emacs/notmuch-show.el
\r
82 > +++ b/emacs/notmuch-show.el
\r
83 > @@ -871,6 +871,21 @@ message at DEPTH in the current thread."
\r
84 > ;; showable this returns nil.
\r
85 > (notmuch-show-create-part-overlays button part-beg part-end))))
\r
87 > +(defun notmuch-show-mime-type (part)
\r
88 > + "Return the correct mime-type to use for PART."
\r
89 > + (let ((content-type (downcase (plist-get part :content-type))))
\r
90 > + (or (and (string= content-type "application/octet-stream")
\r
91 > + (notmuch-show-get-mime-type-of-application/octet-stream part))
\r
92 > + (and (string= content-type "inline patch")
\r
96 > +(defun notmuch-show-insert-header-p (part)
\r
97 > + "Return non-NIL if a header button should be inserted for this part."
\r
98 > + (let ((mime-type (notmuch-show-mime-type part)))
\r
99 > + (not (and (string= mime-type "text/plain")
\r
100 > + (<= (plist-get part :id) 1)))))
\r
102 My only query here is whether a notmuch-show-hide-header-p (part) might
\r
103 make some of the logic clearer?
\r
109 > (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
\r
110 > "Insert the body part PART at depth DEPTH in the current thread.
\r
112 > @@ -881,19 +896,15 @@ is t, hide the part initially and show the button. If HIDE is
\r
113 > useful for quoting in replies)."
\r
115 > (let* ((content-type (downcase (plist-get part :content-type)))
\r
116 > - (mime-type (or (and (string= content-type "application/octet-stream")
\r
117 > - (notmuch-show-get-mime-type-of-application/octet-stream part))
\r
118 > - (and (string= content-type "inline patch")
\r
121 > + (mime-type (notmuch-show-mime-type part))
\r
122 > (nth (plist-get part :id))
\r
124 > ;; Hide the part initially if HIDE is t.
\r
125 > (show-part (not (equal hide t)))
\r
126 > ;; We omit the part button for the first (or only) part if
\r
127 > ;; this is text/plain, or HIDE is 'no-buttons.
\r
128 > - (button (unless (or (equal hide 'no-buttons)
\r
129 > - (and (string= mime-type "text/plain") (<= nth 1)))
\r
130 > + (button (when (and (not (equal hide 'no-buttons))
\r
131 > + (notmuch-show-insert-header-p part))
\r
132 > (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
\r
133 > (content-beg (point)))
\r
138 > _______________________________________________
\r
139 > notmuch mailing list
\r
140 > notmuch@notmuchmail.org
\r
141 > http://notmuchmail.org/mailman/listinfo/notmuch
\r