Re: Error with contrib/notmuch-pick
[notmuch-archives.git] / 24 / e046cf1b96da5385381dd7cb044cd4ea00d727
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 173D7421198\r
6         for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 02:33:13 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \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 RJv2QwqLyuNA for <notmuch@notmuchmail.org>;\r
16         Mon, 23 Jan 2012 02:33:12 -0800 (PST)\r
17 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
18         [74.125.82.181]) (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 367AD429E5B\r
21         for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 02:33:12 -0800 (PST)\r
22 Received: by werb10 with SMTP id b10so2306566wer.26\r
23         for <notmuch@notmuchmail.org>; Mon, 23 Jan 2012 02:33:09 -0800 (PST)\r
24 MIME-Version: 1.0\r
25 Received: by 10.181.13.113 with SMTP id ex17mr1331821wid.15.1327314789673;\r
26         Mon, 23 Jan 2012 02:33:09 -0800 (PST)\r
27 Received: from hotblack-desiato.hh.sledj.net\r
28         (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
29         by mx.google.com with ESMTPS id n3sm39602066wiz.9.2012.01.23.02.33.08\r
30         (version=TLSv1/SSLv3 cipher=OTHER);\r
31         Mon, 23 Jan 2012 02:33:08 -0800 (PST)\r
32 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
33         id ADF8F9FDA3; Mon, 23 Jan 2012 10:33:06 +0000 (GMT)\r
34 From: David Edmondson <dme@dme.org>\r
35 To: notmuch@notmuchmail.org\r
36 Subject: [PATCH 2/3 v2] emacs: Optionally hide some part headers.\r
37 Date: Mon, 23 Jan 2012 10:33:03 +0000\r
38 Message-Id: <1327314784-22555-2-git-send-email-dme@dme.org>\r
39 X-Mailer: git-send-email 1.7.8.3\r
40 In-Reply-To: <1327314784-22555-1-git-send-email-dme@dme.org>\r
41 References: <cun39b66avm.fsf@hotblack-desiato.hh.sledj.net>\r
42         <1327314784-22555-1-git-send-email-dme@dme.org>\r
43 X-Gm-Message-State:\r
44  ALoCoQmp33EGB8oIb0YhBkezT7LnEczsrCprJQCjiBqBxYyJr3D+3hDsNzX9EfD81gau4a7ndwHN\r
45 X-BeenThere: notmuch@notmuchmail.org\r
46 X-Mailman-Version: 2.1.13\r
47 Precedence: list\r
48 List-Id: "Use and development of the notmuch mail system."\r
49         <notmuch.notmuchmail.org>\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
53 List-Post: <mailto:notmuch@notmuchmail.org>\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
57 X-List-Received-Date: Mon, 23 Jan 2012 10:33:13 -0000\r
58 \r
59 Add a regexp, `notmuch-show-part-headers-hidden' and if the\r
60 content-type of a part matches, don't show the part header.\r
61 ---\r
62  emacs/notmuch-show.el |   41 +++++++++++++++++++++++++++--------------\r
63  1 files changed, 27 insertions(+), 14 deletions(-)\r
64 \r
65 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
66 index 9144484..39f35ed 100644\r
67 --- a/emacs/notmuch-show.el\r
68 +++ b/emacs/notmuch-show.el\r
69 @@ -110,6 +110,12 @@ indentation."\r
70    :group 'notmuch\r
71    :type 'boolean)\r
72  \r
73 +(defcustom notmuch-show-part-headers-hidden nil\r
74 +  "Headers for parts whose content-type matches this regexp will\r
75 +not be shown."\r
76 +  :group 'notmuch\r
77 +  :type 'regexp)\r
78 +\r
79  (defmacro with-current-notmuch-show-message (&rest body)\r
80    "Evaluate body with current buffer set to the text of current message"\r
81    `(save-excursion\r
82 @@ -285,23 +291,30 @@ message at DEPTH in the current thread."\r
83    'follow-link t\r
84    'face 'message-mml)\r
85  \r
86 +(defun notmuch-show-hidden-part-header (content-type)\r
87 +  "Return non-nil if a part header should be hidden for\r
88 +CONTENT-TYPE parts."\r
89 +  (and notmuch-show-part-headers-hidden\r
90 +       (string-match notmuch-show-part-headers-hidden content-type)))\r
91 +\r
92  (defun notmuch-show-insert-part-header (nth content-type declared-type\r
93                                             &optional name comment\r
94                                             &rest button-parameters)\r
95 -  (apply #'insert-button\r
96 -        (concat "[ "\r
97 -                (if name (concat name ": ") "")\r
98 -                declared-type\r
99 -                (if (not (string-equal declared-type content-type))\r
100 -                    (concat " (as " content-type ")")\r
101 -                  "")\r
102 -                (or comment "")\r
103 -                " ]")\r
104 -        :type 'notmuch-show-part-button-type\r
105 -        :notmuch-part nth\r
106 -        :notmuch-filename name\r
107 -        button-parameters)\r
108 -  (insert "\n"))\r
109 +  (unless (notmuch-show-hidden-part-header content-type)\r
110 +    (apply #'insert-button\r
111 +          (concat "[ "\r
112 +                  (if name (concat name ": ") "")\r
113 +                  declared-type\r
114 +                  (if (not (string-equal declared-type content-type))\r
115 +                      (concat " (as " content-type ")")\r
116 +                    "")\r
117 +                  (or comment "")\r
118 +                  " ]")\r
119 +          :type 'notmuch-show-part-button-type\r
120 +          :notmuch-part nth\r
121 +          :notmuch-filename name\r
122 +          button-parameters)\r
123 +    (insert "\n")))\r
124  \r
125  ;; Functions handling particular MIME parts.\r
126  \r
127 -- \r
128 1.7.8.3\r
129 \r