1 Return-Path: <amdragon@mit.edu>
\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 DDDFD431FD7
\r
6 for <notmuch@notmuchmail.org>; Fri, 14 Dec 2012 21:15:28 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 JJJNuW+yDBr4 for <notmuch@notmuchmail.org>;
\r
16 Fri, 14 Dec 2012 21:15:28 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 553E9431FBF
\r
20 for <notmuch@notmuchmail.org>; Fri, 14 Dec 2012 21:15:28 -0800 (PST)
\r
21 X-AuditID: 12074423-b7fcb6d000000927-fc-50cc076f0c30
\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
23 by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 8A.A1.02343.F670CC05; Sat, 15 Dec 2012 00:15:27 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id qBF5FQQj020494;
\r
27 Sat, 15 Dec 2012 00:15:26 -0500
\r
28 Received: from drake.dyndns.org
\r
29 (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com
\r
30 [209.6.116.242]) (authenticated bits=0)
\r
31 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
32 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qBF5FO2o011446
\r
33 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
34 Sat, 15 Dec 2012 00:15:26 -0500 (EST)
\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)
\r
36 (envelope-from <amdragon@mit.edu>)
\r
37 id 1Tjk5s-0002kU-8U; Sat, 15 Dec 2012 00:15:24 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH 4/7] emacs: Improve error handling for
\r
41 notmuch-call-notmuch-json
\r
42 Date: Sat, 15 Dec 2012 00:15:10 -0500
\r
43 Message-Id: <1355548513-10085-5-git-send-email-amdragon@mit.edu>
\r
44 X-Mailer: git-send-email 1.7.10.4
\r
45 In-Reply-To: <1355548513-10085-1-git-send-email-amdragon@mit.edu>
\r
46 References: <1355548513-10085-1-git-send-email-amdragon@mit.edu>
\r
47 X-Brightmail-Tracker:
\r
48 H4sIAAAAAAAAA+NgFjrJIsWRmVeSWpSXmKPExsUixG6nrpvPfibA4PYcY4vVc3ksrt+cyezA
\r
49 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZSzecJO94BtPxcW/M5gbGOdwdTFyckgImEhM
\r
50 +bGeBcIWk7hwbz1bFyMXh5DAPkaJB+1LGSGcDYwSExasY4ZwHjFJTOu8xQ7hzGWUOLTlDSNI
\r
51 P5uAhsS2/cvBbBEBaYmdd2ezgtjMAo4Sn/cvYgOxhQUCJGZNXwxWwyKgKnG/7RKYzSvgINH3
\r
52 /gY7xB2KEt3PJoDVcwL1Lvt4Duw+IaCas6/usk5g5F/AyLCKUTYlt0o3NzEzpzg1Wbc4OTEv
\r
53 L7VI10wvN7NELzWldBMjOJRclHcw/jmodIhRgINRiYd3Z8TpACHWxLLiytxDjJIcTEqivLcY
\r
54 zgQI8SXlp1RmJBZnxBeV5qQWH2KU4GBWEuEV2wJUzpuSWFmVWpQPk5LmYFES572WctNfSCA9
\r
55 sSQ1OzW1ILUIJivDwaEkwdvMBjRUsCg1PbUiLTOnBCHNxMEJMpwHaDgXSA1vcUFibnFmOkT+
\r
56 FKMuR8PLG08ZhVjy8vNSpcR5n7ACFQmAFGWU5sHNgaWAV4ziQG8J80aDjOIBpg+4Sa+AljAB
\r
57 LYm7dBxkSUkiQkqqgXH6Ac7pEu7rRbT5p6iLbe6df/DAm7pHrb8OLymWTxA423K2Zk/phNj3
\r
58 z0wkrpc5ZC0U3My0iun+rCurwqqa5MVCvlxST5tjun/q4Qo/iatZbr3b3164vWFe9c3A8FSZ
\r
59 p82vp+u6FQUq/NnQqjR1c63ENx6hE4K3VBg1uG9ctrVkc3F4nfEzo0uJpTgj0VCLuag4EQDp
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.13
\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: Sat, 15 Dec 2012 05:15:29 -0000
\r
75 This checks for non-zero exit status from JSON CLI calls and pops up
\r
76 an error buffer with stderr and stdout. A consequence of this is that
\r
77 show and reply now handle errors, rather than ignoring them.
\r
79 emacs/notmuch-lib.el | 22 +++++++++++++++-------
\r
80 1 file changed, 15 insertions(+), 7 deletions(-)
\r
82 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
83 index 4b71116..9222de8 100644
\r
84 --- a/emacs/notmuch-lib.el
\r
85 +++ b/emacs/notmuch-lib.el
\r
86 @@ -373,15 +373,23 @@ contents of ERR-FILE will be included in the error message."
\r
87 "Invoke `notmuch-command' with `args' and return the parsed JSON output.
\r
89 The returned output will represent objects using property lists
\r
90 -and arrays as lists."
\r
91 +and arrays as lists. If notmuch exits with a non-zero status,
\r
92 +this will pop up a buffer containing notmuch's output and signal
\r
96 - (apply #'call-process notmuch-command nil (list t nil) nil args)
\r
97 - (goto-char (point-min))
\r
98 - (let ((json-object-type 'plist)
\r
99 - (json-array-type 'list)
\r
100 - (json-false 'nil))
\r
102 + (let ((err-file (make-temp-file "nmerr")))
\r
104 + (let ((status (apply #'call-process
\r
105 + notmuch-command nil (list t err-file) nil args)))
\r
106 + (notmuch-check-exit-status status (cons notmuch-command args)
\r
107 + (buffer-string) err-file)
\r
108 + (goto-char (point-min))
\r
109 + (let ((json-object-type 'plist)
\r
110 + (json-array-type 'list)
\r
111 + (json-false 'nil))
\r
113 + (delete-file err-file)))))
\r
115 ;; Compatibility functions for versions of emacs before emacs 23.
\r