Re: notmuch.el: controlling what does and doesn't get expanded in searches
[notmuch-archives.git] / 7d / 00707a026d173c6fa3542578b9881e3b0815ec
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 ADF42431FAF\r
6         for <notmuch@notmuchmail.org>; Mon,  6 Feb 2012 07:39:20 -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 oUr2KLlSCWql for <notmuch@notmuchmail.org>;\r
16         Mon,  6 Feb 2012 07:39:18 -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 98C20431FBD\r
21         for <notmuch@notmuchmail.org>; Mon,  6 Feb 2012 07:39:16 -0800 (PST)\r
22 Received: by werb10 with SMTP id b10so5266644wer.26\r
23         for <notmuch@notmuchmail.org>; Mon, 06 Feb 2012 07:39:13 -0800 (PST)\r
24 Received: by 10.216.135.214 with SMTP id u64mr7012639wei.58.1328542753866;\r
25         Mon, 06 Feb 2012 07:39:13 -0800 (PST)\r
26 Received: from hotblack-desiato.hh.sledj.net\r
27         (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
28         by mx.google.com with ESMTPS id p10sm26449810wic.0.2012.02.06.07.39.10\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Mon, 06 Feb 2012 07:39:11 -0800 (PST)\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
32         id 4FA7FA0C40; Mon,  6 Feb 2012 15:39:09 +0000 (GMT)\r
33 From: David Edmondson <dme@dme.org>\r
34 To: notmuch@notmuchmail.org\r
35 Subject: [PATCH v3 1/3] emacs: Don't return the button from\r
36         `notmuch-show-insert-part-header'.\r
37 Date: Mon,  6 Feb 2012 15:39:06 +0000\r
38 Message-Id: <1328542748-19530-3-git-send-email-dme@dme.org>\r
39 X-Mailer: git-send-email 1.7.8.3\r
40 In-Reply-To: <1328542748-19530-1-git-send-email-dme@dme.org>\r
41 References: <1327052612-1040-1-git-send-email-dme@dme.org>\r
42         <1328542748-19530-1-git-send-email-dme@dme.org>\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Mon, 06 Feb 2012 15:39:21 -0000\r
56 \r
57 Instead, allow the caller to specify some parameters for the\r
58 button. Rework `notmuch-show-insert-part-multipart/signed' and\r
59 `notmuch-show-insert-part-multipart/encrypted' accordingly.\r
60 ---\r
61  emacs/notmuch-show.el |   86 +++++++++++++++++++++++++-----------------------\r
62  1 files changed, 45 insertions(+), 41 deletions(-)\r
63 \r
64 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
65 index 7469e2e..079d7cb 100644\r
66 --- a/emacs/notmuch-show.el\r
67 +++ b/emacs/notmuch-show.el\r
68 @@ -397,25 +397,24 @@ message at DEPTH in the current thread."\r
69    "Submap for button commands")\r
70  (fset 'notmuch-show-part-button-map notmuch-show-part-button-map)\r
71  \r
72 -(defun notmuch-show-insert-part-header (nth content-type declared-type &optional name comment)\r
73 -  (let ((button))\r
74 -    (setq button\r
75 -         (insert-button\r
76 -          (concat "[ "\r
77 -                  (if name (concat name ": ") "")\r
78 -                  declared-type\r
79 -                  (if (not (string-equal declared-type content-type))\r
80 -                      (concat " (as " content-type ")")\r
81 -                    "")\r
82 -                  (or comment "")\r
83 -                  " ]")\r
84 -          :type 'notmuch-show-part-button-type\r
85 -          :notmuch-part nth\r
86 -          :notmuch-filename name\r
87 -          :notmuch-content-type content-type))\r
88 -    (insert "\n")\r
89 -    ;; return button\r
90 -    button))\r
91 +(defun notmuch-show-insert-part-header (nth content-type declared-type\r
92 +                                           &optional name comment\r
93 +                                           &rest button-parameters)\r
94 +  (apply #'insert-button\r
95 +        (concat "[ "\r
96 +                (if name (concat name ": ") "")\r
97 +                declared-type\r
98 +                (if (not (string-equal declared-type content-type))\r
99 +                    (concat " (as " content-type ")")\r
100 +                  "")\r
101 +                (or comment "")\r
102 +                " ]")\r
103 +        :type 'notmuch-show-part-button-type\r
104 +        :notmuch-part nth\r
105 +        :notmuch-filename name\r
106 +        :notmuch-content-type content-type\r
107 +        button-parameters)\r
108 +  (insert "\n"))\r
109  \r
110  ;; Functions handling particular MIME parts.\r
111  \r
112 @@ -602,15 +601,18 @@ current buffer, if possible."\r
113    t)\r
114  \r
115  (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth declared-type)\r
116 -  (let ((button (notmuch-show-insert-part-header nth declared-type content-type nil)))\r
117 -    (button-put button 'face 'notmuch-crypto-part-header)\r
118 -    ;; add signature status button if sigstatus provided\r
119 -    (if (plist-member part :sigstatus)\r
120 -       (let* ((from (notmuch-show-get-header :From msg))\r
121 -              (sigstatus (car (plist-get part :sigstatus))))\r
122 -         (notmuch-crypto-insert-sigstatus-button sigstatus from))\r
123 -      ;; if we're not adding sigstatus, tell the user how they can get it\r
124 -      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))\r
125 +  ;; Add signature status button if sigstatus provided.\r
126 +  (if (plist-member part :sigstatus)\r
127 +      (let ((from (notmuch-show-get-header :From msg))\r
128 +           (sigstatus (car (plist-get part :sigstatus))))\r
129 +       (notmuch-show-insert-part-header nth declared-type content-type nil nil \r
130 +                                        'face 'notmuch-crypto-part-header)\r
131 +       (notmuch-crypto-insert-sigstatus-button sigstatus from))\r
132 +\r
133 +    ;; If we're not adding sigstatus, tell the user how to enable it.\r
134 +    (notmuch-show-insert-part-header nth declared-type content-type nil nil \r
135 +                                    'face 'notmuch-crypto-part-header\r
136 +                                    'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts."))\r
137  \r
138    (let ((inner-parts (plist-get part :content))\r
139         (start (point)))\r
140 @@ -624,19 +626,21 @@ current buffer, if possible."\r
141    t)\r
142  \r
143  (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth declared-type)\r
144 -  (let ((button (notmuch-show-insert-part-header nth declared-type content-type nil)))\r
145 -    (button-put button 'face 'notmuch-crypto-part-header)\r
146 -    ;; add encryption status button if encstatus specified\r
147 -    (if (plist-member part :encstatus)\r
148 -       (let ((encstatus (car (plist-get part :encstatus))))\r
149 -         (notmuch-crypto-insert-encstatus-button encstatus)\r
150 -         ;; add signature status button if sigstatus specified\r
151 -         (if (plist-member part :sigstatus)\r
152 -             (let* ((from (notmuch-show-get-header :From msg))\r
153 -                    (sigstatus (car (plist-get part :sigstatus))))\r
154 -               (notmuch-crypto-insert-sigstatus-button sigstatus from))))\r
155 -      ;; if we're not adding encstatus, tell the user how they can get it\r
156 -      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))\r
157 +  ;; Add encryption status button if encstatus provided.\r
158 +  (if (plist-member part :encstatus)\r
159 +      (let ((encstatus (car (plist-get part :encstatus))))\r
160 +       (notmuch-show-insert-part-header nth declared-type content-type nil nil \r
161 +                                        'face 'notmuch-crypto-part-header)\r
162 +       (notmuch-crypto-insert-encstatus-button encstatus)\r
163 +       ;; add signature status button if sigstatus specified\r
164 +       (if (plist-member part :sigstatus)\r
165 +           (let* ((from (notmuch-show-get-header :From msg))\r
166 +                  (sigstatus (car (plist-get part :sigstatus))))\r
167 +             (notmuch-crypto-insert-sigstatus-button sigstatus from))))\r
168 +    ;; If we're not adding encstatus, tell the user how to enable it.\r
169 +    (notmuch-show-insert-part-header nth declared-type content-type nil nil \r
170 +                                    'face 'notmuch-crypto-part-header\r
171 +                                    'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts."))\r
172  \r
173    (let ((inner-parts (plist-get part :content))\r
174         (start (point)))\r
175 -- \r
176 1.7.8.3\r
177 \r