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 1FFA8431FC2
\r
6 for <notmuch@notmuchmail.org>; Mon, 12 May 2014 05:29:44 -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 ws3jpj2D4Fee for <notmuch@notmuchmail.org>;
\r
16 Mon, 12 May 2014 05:29:38 -0700 (PDT)
\r
17 Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com
\r
18 [209.85.212.173]) (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 146AB431FCB
\r
21 for <notmuch@notmuchmail.org>; Mon, 12 May 2014 05:29:33 -0700 (PDT)
\r
22 Received: by mail-wi0-f173.google.com with SMTP id bs8so4359779wib.6
\r
23 for <notmuch@notmuchmail.org>; Mon, 12 May 2014 05:29:31 -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:from:to:subject:date:message-id:in-reply-to
\r
28 bh=ipdvO6xL3t8JHovYHW3OTwGHJbS5OJkzs4NgmemMm2Y=;
\r
29 b=YsojfmzIinrqYW4N/Mh3mkhfa9mNnBaxP5vp3wPpwsdvbVpfI0Hzx5RXOMtB9RgHLJ
\r
30 nQmu2AdZjXtkzLJAPrA48/z4AzoRc52vDWO3MGGIjR62tkgj24QCmMEOOCLEQWFcUU/t
\r
31 JZ4itzcs1O9Lgmw7kXC/9NPNKxLn4fmQvK4YPbnWyln3/Lp9e7A22dJG9xnECgvvMfor
\r
32 4D3Rvyhnf6oevi9R3LB4ETUzhkq7acmZDf07hvKI4RTTBFOxoex8FkpNhwNyrSnO5/Bq
\r
33 Dm7/D73eI0pK6iZ+xtj34pbGA0SN9x6ECb0CEh6EG7knlBHSbxNhmbi/C1rUFkxvohcx
\r
36 ALoCoQmpQhZzkdvQdMBVSBk0H0/FCyBR2zovZEq11OmV7oHjhe6zyeh9eM+n21GFDb9ejJN9vPKP
\r
37 X-Received: by 10.180.19.201 with SMTP id h9mr3258424wie.17.1399897771659;
\r
38 Mon, 12 May 2014 05:29:31 -0700 (PDT)
\r
39 Received: from hotblack-desiato.hh.sledj.net (disaster-area.hh.sledj.net.
\r
40 [81.149.164.25]) by mx.google.com with ESMTPSA id
\r
41 l12sm17746272wjr.35.2014.05.12.05.29.29 for <notmuch@notmuchmail.org>
\r
42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
43 Mon, 12 May 2014 05:29:30 -0700 (PDT)
\r
44 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
45 id 3625610B308; Mon, 12 May 2014 13:29:29 +0100 (BST)
\r
46 From: David Edmondson <dme@dme.org>
\r
47 To: notmuch@notmuchmail.org
\r
48 Subject: [PATCH v3 1/9] emacs/show: Re-arrange determination if a part header
\r
50 Date: Mon, 12 May 2014 13:29:21 +0100
\r
51 Message-Id: <1399897769-26809-2-git-send-email-dme@dme.org>
\r
52 X-Mailer: git-send-email 2.0.0.rc0
\r
53 In-Reply-To: <1399897769-26809-1-git-send-email-dme@dme.org>
\r
54 References: <87sixdujkv.fsf@qmul.ac.uk>
\r
55 <1399897769-26809-1-git-send-email-dme@dme.org>
\r
56 X-BeenThere: notmuch@notmuchmail.org
\r
57 X-Mailman-Version: 2.1.13
\r
59 List-Id: "Use and development of the notmuch mail system."
\r
60 <notmuch.notmuchmail.org>
\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
64 List-Post: <mailto:notmuch@notmuchmail.org>
\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
68 X-List-Received-Date: Mon, 12 May 2014 12:29:44 -0000
\r
70 Move the determination of whether a part header is required to a
\r
73 emacs/notmuch-show.el | 25 ++++++++++++++++++-------
\r
74 1 file changed, 18 insertions(+), 7 deletions(-)
\r
76 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
77 index 10fc872..ec99141 100644
\r
78 --- a/emacs/notmuch-show.el
\r
79 +++ b/emacs/notmuch-show.el
\r
80 @@ -871,6 +871,21 @@ message at DEPTH in the current thread."
\r
81 ;; showable this returns nil.
\r
82 (notmuch-show-create-part-overlays button part-beg part-end))))
\r
84 +(defun notmuch-show-mime-type (part)
\r
85 + "Return the correct mime-type to use for PART."
\r
86 + (let ((content-type (downcase (plist-get part :content-type))))
\r
87 + (or (and (string= content-type "application/octet-stream")
\r
88 + (notmuch-show-get-mime-type-of-application/octet-stream part))
\r
89 + (and (string= content-type "inline patch")
\r
93 +(defun notmuch-show-insert-header-p (part)
\r
94 + "Return non-NIL if a header button should be inserted for this part."
\r
95 + (let ((mime-type (notmuch-show-mime-type part)))
\r
96 + (not (and (string= mime-type "text/plain")
\r
97 + (<= (plist-get part :id) 1)))))
\r
99 (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
\r
100 "Insert the body part PART at depth DEPTH in the current thread.
\r
102 @@ -881,19 +896,15 @@ is t, hide the part initially and show the button. If HIDE is
\r
103 useful for quoting in replies)."
\r
105 (let* ((content-type (downcase (plist-get part :content-type)))
\r
106 - (mime-type (or (and (string= content-type "application/octet-stream")
\r
107 - (notmuch-show-get-mime-type-of-application/octet-stream part))
\r
108 - (and (string= content-type "inline patch")
\r
111 + (mime-type (notmuch-show-mime-type part))
\r
112 (nth (plist-get part :id))
\r
114 ;; Hide the part initially if HIDE is t.
\r
115 (show-part (not (equal hide t)))
\r
116 ;; We omit the part button for the first (or only) part if
\r
117 ;; this is text/plain, or HIDE is 'no-buttons.
\r
118 - (button (unless (or (equal hide 'no-buttons)
\r
119 - (and (string= mime-type "text/plain") (<= nth 1)))
\r
120 + (button (when (and (not (equal hide 'no-buttons))
\r
121 + (notmuch-show-insert-header-p part))
\r
122 (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
\r
123 (content-beg (point)))
\r