Re: [PATCH 3/3] new: don't read unchanged directories from disk
[notmuch-archives.git] / 0c / 667647862990ac18fb93e422e15fc6e999a376
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 55AB7431FC9\r
6         for <notmuch@notmuchmail.org>; Fri, 20 Jan 2012 02:34:26 -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 kIOmVoj5jnW2 for <notmuch@notmuchmail.org>;\r
16         Fri, 20 Jan 2012 02:34:24 -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 8E0ED431FB6\r
21         for <notmuch@notmuchmail.org>; Fri, 20 Jan 2012 02:34:24 -0800 (PST)\r
22 Received: by wibhr12 with SMTP id hr12so329953wib.26\r
23         for <notmuch@notmuchmail.org>; Fri, 20 Jan 2012 02:34:23 -0800 (PST)\r
24 Received: by 10.180.95.131 with SMTP id dk3mr2721832wib.6.1327055663347;\r
25         Fri, 20 Jan 2012 02:34:23 -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 g12sm7566337wiw.10.2012.01.20.02.34.20\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Fri, 20 Jan 2012 02:34:21 -0800 (PST)\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
32         id 50AA2A06F6; Fri, 20 Jan 2012 09:43:33 +0000 (GMT)\r
33 From: David Edmondson <dme@dme.org>\r
34 To: notmuch@notmuchmail.org\r
35 Subject: [PATCH 2/3] emacs: Don't return the button from\r
36         `notmuch-show-insert-part-header'.\r
37 Date: Fri, 20 Jan 2012 09:43:31 +0000\r
38 Message-Id: <1327052612-1040-2-git-send-email-dme@dme.org>\r
39 X-Mailer: git-send-email 1.7.8.3\r
40 In-Reply-To: <1327052612-1040-1-git-send-email-dme@dme.org>\r
41 References: <1327052612-1040-1-git-send-email-dme@dme.org>\r
42 X-BeenThere: notmuch@notmuchmail.org\r
43 X-Mailman-Version: 2.1.13\r
44 Precedence: list\r
45 List-Id: "Use and development of the notmuch mail system."\r
46         <notmuch.notmuchmail.org>\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
50 List-Post: <mailto:notmuch@notmuchmail.org>\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
54 X-List-Received-Date: Fri, 20 Jan 2012 10:34:26 -0000\r
55 \r
56 Instead, allow the caller to specify some parameters for the\r
57 button. Rework `notmuch-show-insert-part-multipart/signed' and\r
58 `notmuch-show-insert-part-multipart/encrypted' accordingly, moving\r
59 most of the code into a common\r
60 `notmuch-show-insert-part-multipart/signed-or-encrypted' to reduce\r
61 duplication.\r
62 ---\r
63 \r
64 The buttons inserted for encrypted parts are slightly different now -\r
65 previously the logic was that if a part was encrypted it would have\r
66 the signature status inserted only if the encryption status was\r
67 specified. Now the signature status will be inserted even without\r
68 encryption status. My reading of the documentation says that this is\r
69 correct, but I'm no expert. Comments?\r
70 \r
71  emacs/notmuch-show.el |   88 +++++++++++++++++++++---------------------------\r
72  1 files changed, 39 insertions(+), 49 deletions(-)\r
73 \r
74 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
75 index f62f8ac..97e2a15 100644\r
76 --- a/emacs/notmuch-show.el\r
77 +++ b/emacs/notmuch-show.el\r
78 @@ -285,22 +285,23 @@ message at DEPTH in the current thread."\r
79    'follow-link t\r
80    'face 'message-mml)\r
81  \r
82 -(defun notmuch-show-insert-part-header (nth content-type declared-type &optional name comment)\r
83 -  (let ((button (insert-button\r
84 -                (concat "[ "\r
85 -                        (if name (concat name ": ") "")\r
86 -                        declared-type\r
87 -                        (if (not (string-equal declared-type content-type))\r
88 -                            (concat " (as " content-type ")")\r
89 -                          "")\r
90 -                        (or comment "")\r
91 -                        " ]")\r
92 -                :type 'notmuch-show-part-button-type\r
93 -                :notmuch-part nth\r
94 -                :notmuch-filename name)))\r
95 -    (insert "\n")\r
96 -    ;; return button\r
97 -    button))\r
98 +(defun notmuch-show-insert-part-header (nth content-type declared-type\r
99 +                                           &optional name comment\r
100 +                                           &rest button-parameters)\r
101 +  (apply #'insert-button\r
102 +        (concat "[ "\r
103 +                (if name (concat name ": ") "")\r
104 +                declared-type\r
105 +                (if (not (string-equal declared-type content-type))\r
106 +                    (concat " (as " content-type ")")\r
107 +                  "")\r
108 +                (or comment "")\r
109 +                " ]")\r
110 +        :type 'notmuch-show-part-button-type\r
111 +        :notmuch-part nth\r
112 +        :notmuch-filename name\r
113 +        button-parameters)\r
114 +  (insert "\n"))\r
115  \r
116  ;; Functions handling particular MIME parts.\r
117  \r
118 @@ -458,42 +459,31 @@ current buffer, if possible."\r
119    t)\r
120  \r
121  (defun notmuch-show-insert-part-multipart/signed (msg part content-type nth depth declared-type)\r
122 -  (let ((button (notmuch-show-insert-part-header nth declared-type content-type nil)))\r
123 -    (button-put button 'face 'notmuch-crypto-part-header)\r
124 -    ;; add signature status button if sigstatus provided\r
125 -    (if (plist-member part :sigstatus)\r
126 -       (let* ((from (notmuch-show-get-header :From msg))\r
127 -              (sigstatus (car (plist-get part :sigstatus))))\r
128 -         (notmuch-crypto-insert-sigstatus-button sigstatus from))\r
129 -      ;; if we're not adding sigstatus, tell the user how they can get it\r
130 -      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))\r
131 -\r
132 -  (let ((inner-parts (plist-get part :content))\r
133 -       (start (point)))\r
134 -    ;; Show all of the parts.\r
135 -    (mapc (lambda (inner-part)\r
136 -           (notmuch-show-insert-bodypart msg inner-part depth))\r
137 -         inner-parts)\r
138 -\r
139 -    (when notmuch-show-indent-multipart\r
140 -      (indent-rigidly start (point) 1)))\r
141 -  t)\r
142 +  (notmuch-show-insert-part-multipart/signed-or-encrypted msg part content-type nth depth declared-type\r
143 +                                                        (plist-get part :sigstatus)\r
144 +                                                        nil))\r
145  \r
146  (defun notmuch-show-insert-part-multipart/encrypted (msg part content-type nth depth declared-type)\r
147 -  (let ((button (notmuch-show-insert-part-header nth declared-type content-type nil)))\r
148 -    (button-put button 'face 'notmuch-crypto-part-header)\r
149 -    ;; add encryption status button if encstatus specified\r
150 -    (if (plist-member part :encstatus)\r
151 -       (let ((encstatus (car (plist-get part :encstatus))))\r
152 -         (notmuch-crypto-insert-encstatus-button encstatus)\r
153 -         ;; add signature status button if sigstatus specified\r
154 -         (if (plist-member part :sigstatus)\r
155 -             (let* ((from (notmuch-show-get-header :From msg))\r
156 -                    (sigstatus (car (plist-get part :sigstatus))))\r
157 -               (notmuch-crypto-insert-sigstatus-button sigstatus from))))\r
158 -      ;; if we're not adding encstatus, tell the user how they can get it\r
159 -      (button-put button 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts.")))\r
160 +  (notmuch-show-insert-part-multipart/signed-or-encrypted msg part content-type nth depth declared-type\r
161 +                                                        (plist-get part :sigstatus)\r
162 +                                                        (plist-get part :encstatus)))\r
163  \r
164 +(defun notmuch-show-insert-part-multipart/signed-or-encrypted (msg part content-type nth depth declared-type sigstatus-tuple encstatus-tuple)\r
165 +  (if (or encstatus-tuple sigstatus-tuple)\r
166 +      (progn\r
167 +       (notmuch-show-insert-part-header nth declared-type content-type\r
168 +                                        nil nil 'face 'notmuch-crypto-part-header)\r
169 +       (if encstatus-tuple\r
170 +           (notmuch-crypto-insert-encstatus-button (car encstatus-tuple)))\r
171 +       (if sigstatus-tuple\r
172 +           (notmuch-crypto-insert-sigstatus-button (car sigstatus-tuple)\r
173 +                                                   (notmuch-show-get-header :From msg))))\r
174 +    ;; If we're not adding status buttons, tell the user how they can\r
175 +    ;; enable them.\r
176 +    (notmuch-show-insert-part-header nth declared-type content-type\r
177 +                                    nil nil 'help-echo "Set notmuch-crypto-process-mime to process cryptographic mime parts."))\r
178 +\r
179 +  ;; Insert the enclosed parts.\r
180    (let ((inner-parts (plist-get part :content))\r
181         (start (point)))\r
182      ;; Show all of the parts.\r
183 -- \r
184 1.7.8.3\r
185 \r