[PATCH] This patch is a little finger excercise for working with git. I found a piece...
[notmuch-archives.git] / 2e / b0910e4d51ca8dba0e479e57aa17bb9c8d8930
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 3DB1642119F\r
6         for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 04:54:01 -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 fOzd960qRPN6 for <notmuch@notmuchmail.org>;\r
16         Tue, 24 Jan 2012 04:54:00 -0800 (PST)\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
18         [209.85.212.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 7113F429E21\r
21         for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 04:54:00 -0800 (PST)\r
22 Received: by wibhi8 with SMTP id hi8so1525144wib.26\r
23         for <notmuch@notmuchmail.org>; Tue, 24 Jan 2012 04:53:59 -0800 (PST)\r
24 MIME-Version: 1.0\r
25 Received: by 10.180.101.164 with SMTP id fh4mr4134455wib.0.1327409639186;\r
26         Tue, 24 Jan 2012 04:53:59 -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 cb8sm14129215wib.0.2012.01.24.04.53.57\r
30         (version=TLSv1/SSLv3 cipher=OTHER);\r
31         Tue, 24 Jan 2012 04:53:57 -0800 (PST)\r
32 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
33         id EB2239FD49; Tue, 24 Jan 2012 12:53:55 +0000 (GMT)\r
34 From: David Edmondson <dme@dme.org>\r
35 To: notmuch@notmuchmail.org\r
36 Subject: [PATCH 2/3] emacs: Optionally hide some part headers.\r
37 Date: Tue, 24 Jan 2012 12:53:39 +0000\r
38 Message-Id: <1327409620-10133-3-git-send-email-dme@dme.org>\r
39 X-Mailer: git-send-email 1.7.8.3\r
40 In-Reply-To: <1327409620-10133-1-git-send-email-dme@dme.org>\r
41 References: <1327052612-1040-1-git-send-email-dme@dme.org>\r
42         <1327409620-10133-1-git-send-email-dme@dme.org>\r
43 X-Gm-Message-State:\r
44  ALoCoQmDSnRfr03Zp3F56tZ0zBiate2jW/Y67HcgPpG2c/newHoswBb6tf7xsUnD06x91FYpo/me\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: Tue, 24 Jan 2012 12:54:01 -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 |   43 ++++++++++++++++++++++++++++---------------\r
63  1 files changed, 28 insertions(+), 15 deletions(-)\r
64 \r
65 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
66 index d0e0d38..a0a2873 100644\r
67 --- a/emacs/notmuch-show.el\r
68 +++ b/emacs/notmuch-show.el\r
69 @@ -123,6 +123,12 @@ indentation."\r
70                  (const :tag "View interactively"\r
71                         notmuch-show-interactively-view-part)))\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 @@ -355,24 +361,31 @@ message at DEPTH in the current thread."\r
83    "Submap for button commands")\r
84  (fset 'notmuch-show-part-button-map notmuch-show-part-button-map)\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 -        :notmuch-content-type content-type\r
108 -        button-parameters)\r
109 -  (insert "\n"))\r
110 +  (unless (notmuch-show-hidden-part-header content-type)\r
111 +    (apply #'insert-button\r
112 +          (concat "[ "\r
113 +                  (if name (concat name ": ") "")\r
114 +                  declared-type\r
115 +                  (if (not (string-equal declared-type content-type))\r
116 +                      (concat " (as " content-type ")")\r
117 +                    "")\r
118 +                  (or comment "")\r
119 +                  " ]")\r
120 +          :type 'notmuch-show-part-button-type\r
121 +          :notmuch-part nth\r
122 +          :notmuch-filename name\r
123 +          :notmuch-content-type content-type\r
124 +          button-parameters)\r
125 +    (insert "\n")))\r
126  \r
127  ;; Functions handling particular MIME parts.\r
128  \r
129 -- \r
130 1.7.8.3\r
131 \r