encrypting replies to encrypted mail
[notmuch-archives.git] / b6 / 8a41fb81ada31357ca870b1130b53ad516392a
1 Return-Path: <m.walters@qmul.ac.uk>\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 4AC4E431FBC\r
6         for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 03:00:43 -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: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id afw67v0E+FnS for <notmuch@notmuchmail.org>;\r
17         Thu, 13 Dec 2012 03:00:42 -0800 (PST)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 48794431FB6\r
22         for <notmuch@notmuchmail.org>; Thu, 13 Dec 2012 03:00:42 -0800 (PST)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1Tj6Wk-0007mi-Ux; Thu, 13 Dec 2012 11:00:36 +0000\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
28         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
29         (envelope-from <m.walters@qmul.ac.uk>)\r
30         id 1Tj6Wk-0007MG-FX; Thu, 13 Dec 2012 11:00:30 +0000\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: Austin Clements <amdragon@MIT.EDU>,notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH 07/10] emacs: Use --use-schema for search\r
34 In-Reply-To: <20121213014341.GC6187@mit.edu>\r
35 References: <1354416002-3557-1-git-send-email-amdragon@mit.edu>\r
36         <1354416002-3557-7-git-send-email-amdragon@mit.edu>\r
37         <87ehj1gc9x.fsf@qmul.ac.uk> <20121213014341.GC6187@mit.edu>\r
38 User-Agent: Notmuch/0.14+155~g7edfdc3 (http://notmuchmail.org) Emacs/23.4.1\r
39         (x86_64-pc-linux-gnu)\r
40 Date: Thu, 13 Dec 2012 11:00:32 +0000\r
41 Message-ID: <87wqwmdxnz.fsf@qmul.ac.uk>\r
42 MIME-Version: 1.0\r
43 Content-Type: text/plain; charset=us-ascii\r
44 X-Sender-Host-Address: 93.97.24.31\r
45 X-QM-SPAM-Info: Sender has good ham record.  :)\r
46 X-QM-Body-MD5: b59664664e3162e334e982da296f1eba (of first 20000 bytes)\r
47 X-SpamAssassin-Score: -1.8\r
48 X-SpamAssassin-SpamBar: -\r
49 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
50         determine if it is\r
51         spam. We require at least 5.0 points to mark a message as spam.\r
52         This message scored -1.8 points.\r
53         Summary of the scoring: \r
54         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
55         *      medium trust\r
56         *      [138.37.6.40 listed in list.dnswl.org]\r
57         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
58         provider *      (markwalters1009[at]gmail.com)\r
59         *  0.5 AWL AWL: From: address is in the auto white-list\r
60 X-QM-Scan-Virus: ClamAV says the message is clean\r
61 X-BeenThere: notmuch@notmuchmail.org\r
62 X-Mailman-Version: 2.1.13\r
63 Precedence: list\r
64 List-Id: "Use and development of the notmuch mail system."\r
65         <notmuch.notmuchmail.org>\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
69 List-Post: <mailto:notmuch@notmuchmail.org>\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
73 X-List-Received-Date: Thu, 13 Dec 2012 11:00:43 -0000\r
74 \r
75 On Thu, 13 Dec 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
76 > Quoth Mark Walters on Dec 08 at  8:48 am:\r
77 >> On Sun, 02 Dec 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
78 >> > We detect the special exit statuses and use these to produce specific\r
79 >> > diagnostic messages.\r
80 >> > ---\r
81 >> >  emacs/notmuch-lib.el |   32 ++++++++++++++++++++++++++++++++\r
82 >> >  emacs/notmuch.el     |   17 +++++++++++++----\r
83 >> >  2 files changed, 45 insertions(+), 4 deletions(-)\r
84 >> >\r
85 >> > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
86 >> > index 9402456..49b0da6 100644\r
87 >> > --- a/emacs/notmuch-lib.el\r
88 >> > +++ b/emacs/notmuch-lib.el\r
89 >> > @@ -325,6 +325,38 @@ string), a property list of face attributes, or a list of these."\r
90 >> >    (put-text-property pos next 'face (cons face cur))\r
91 >> >    (setq pos next)))))\r
92 >> >  \r
93 >> > +(defun notmuch-pop-up-error (msg)\r
94 >> > +  "Pop up an error buffer displaying MSG."\r
95 >> > +\r
96 >> > +  (let ((buf (get-buffer-create "*Notmuch errors*")))\r
97 >> > +    (with-current-buffer buf\r
98 >> > +      (view-mode)\r
99 >> > +      (let ((inhibit-read-only t))\r
100 >> > +  (erase-buffer)\r
101 >> > +  (insert msg)\r
102 >> > +  (unless (bolp)\r
103 >> > +    (insert "\n"))\r
104 >> > +  (goto-char (point-min))))\r
105 >> > +    (pop-to-buffer buf)))\r
106 >> \r
107 >> I am not sure about the erase-buffer in the above: do we definitely want\r
108 >> to remove all previous error information? For version mismatch possibly\r
109 >> we do but in patch 9 it is done for all show command-line error returns.\r
110 >\r
111 > Why wouldn't we want to use a cleared buffer in all cases?\r
112 > notmuch-pop-up-error is only ever used when a command terminates, so\r
113 > there's no danger of us clearing errors that the user hasn't seen yet.\r
114 \r
115 Just to make sure I understand this: whenever an error occurs the error\r
116 popup appears so we see the message. Then the next error can safely\r
117 erase buffer before showing the new error message?\r
118 \r
119 >> Incidentally why does show always pop-up an error but search only for\r
120 >> version-mismatches?\r
121 >\r
122 > Historical reasons, I suppose.  I was maintaining the status quo for\r
123 > search (which already had *some* error handling), but there was no\r
124 > error-handling status quo for show.  Probably search should be more\r
125 > vocal when the command fails.\r
126 \r
127 Should notmuch-call-notmuch-process also be switched to this framework?\r
128 In particular that also puts errors in "*Notmuch errors*" so my earlier\r
129 concern may be valid in this case.\r
130 \r
131 Best wishes\r
132 \r
133 Mark\r
134 >\r
135 >> Otherwise this looks good to me (but I am not that familiar with lisp\r
136 >> error handling)\r
137 >> \r
138 >> Best wishes\r
139 >> \r
140 >> Mark\r
141 >> \r
142 >> \r
143 >> \r
144 >> \r
145 >> \r
146 >> \r
147 >> > +(defun notmuch-version-mismatch-error (exit-status)\r
148 >> > +  "Signal a schema version mismatch error.\r
149 >> > +\r
150 >> > +EXIT-STATUS must be the exit status of the notmuch CLI command,\r
151 >> > +and must have the value 20 or 21.  This function will pop up an\r
152 >> > +error buffer with a descriptive message and signal an error."\r
153 >> > +  (cond ((= exit-status 20)\r
154 >> > +   (notmuch-pop-up-error "Error: Version mismatch.\r
155 >> > +Emacs requested an older output format than supported by the notmuch CLI.\r
156 >> > +You may need to restart Emacs or upgrade your notmuch Emacs package."))\r
157 >> > +  ((= exit-status 21)\r
158 >> > +   (notmuch-pop-up-error "Error: Version mismatch.\r
159 >> > +Emacs requested a newer output format than supported by the notmuch CLI.\r
160 >> > +You may need to restart Emacs or upgrade your notmuch package."))\r
161 >> > +  (t\r
162 >> > +   (error "Bad exit status %d" exit-status)))\r
163 >> > +  (error "notmuch CLI version mismatch"))\r
164 >> > +\r
165 >> >  ;; Compatibility functions for versions of emacs before emacs 23.\r
166 >> >  ;;\r
167 >> >  ;; Both functions here were copied from emacs 23 with the following copyright:\r
168 >> > diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
169 >> > index f9454d8..e1f28ca 100644\r
170 >> > --- a/emacs/notmuch.el\r
171 >> > +++ b/emacs/notmuch.el\r
172 >> > @@ -644,6 +644,7 @@ of the result."\r
173 >> >    (exit-status (process-exit-status proc))\r
174 >> >    (never-found-target-thread nil))\r
175 >> >      (when (memq status '(exit signal))\r
176 >> > +      (catch 'return\r
177 >> >    (kill-buffer (process-get proc 'parse-buf))\r
178 >> >    (if (buffer-live-p buffer)\r
179 >> >        (with-current-buffer buffer\r
180 >> > @@ -655,8 +656,16 @@ of the result."\r
181 >> >                  (insert "Incomplete search results (search process was killed).\n"))\r
182 >> >              (when (eq status 'exit)\r
183 >> >                (insert "End of search results.")\r
184 >> > -              (unless (= exit-status 0)\r
185 >> > -                (insert (format " (process returned %d)" exit-status)))\r
186 >> > +              (cond ((or (= exit-status 20) (= exit-status 21))\r
187 >> > +                     (kill-buffer)\r
188 >> > +                     (condition-case err\r
189 >> > +                         (notmuch-version-mismatch-error exit-status)\r
190 >> > +                       ;; Strange things happen when you signal\r
191 >> > +                       ;; an error from a sentinel.\r
192 >> > +                       (error (throw 'return nil))))\r
193 >> > +                    ((/= exit-status 0)\r
194 >> > +                     (insert (format " (process returned %d)"\r
195 >> > +                                     exit-status))))\r
196 >> >                (insert "\n")\r
197 >> >                (if (and atbob\r
198 >> >                         (not (string= notmuch-search-target-thread "found")))\r
199 >> > @@ -664,7 +673,7 @@ of the result."\r
200 >> >          (when (and never-found-target-thread\r
201 >> >                   notmuch-search-target-line)\r
202 >> >              (goto-char (point-min))\r
203 >> > -            (forward-line (1- notmuch-search-target-line))))))))\r
204 >> > +            (forward-line (1- notmuch-search-target-line)))))))))\r
205 >> >  \r
206 >> >  (defcustom notmuch-search-line-faces '(("unread" :weight bold)\r
207 >> >                                   ("flagged" :foreground "blue"))\r
208 >> > @@ -938,7 +947,7 @@ Other optional parameters are used as follows:\r
209 >> >    (let ((proc (start-process\r
210 >> >                 "notmuch-search" buffer\r
211 >> >                 notmuch-command "search"\r
212 >> > -               "--format=json"\r
213 >> > +               "--format=json" "--use-schema=1"\r
214 >> >                 (if oldest-first\r
215 >> >                     "--sort=oldest-first"\r
216 >> >                   "--sort=newest-first")\r
217 >> >\r
218 >> > _______________________________________________\r
219 >> > notmuch mailing list\r
220 >> > notmuch@notmuchmail.org\r
221 >> > http://notmuchmail.org/mailman/listinfo/notmuch\r
222 >\r
223 > -- \r
224 > Austin Clements                                      MIT/'06/PhD/CSAIL\r
225 > amdragon@mit.edu                           http://web.mit.edu/amdragon\r
226 >        Somewhere in the dream we call reality you will find me,\r
227 >               searching for the reality we call dreams.\r