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 91E8E431FC2
\r
6 for <notmuch@notmuchmail.org>; Fri, 14 Dec 2012 21:15:30 -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 9i9+Zuy1QGFr for <notmuch@notmuchmail.org>;
\r
16 Fri, 14 Dec 2012 21:15:29 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 9C837431FC7
\r
20 for <notmuch@notmuchmail.org>; Fri, 14 Dec 2012 21:15:28 -0800 (PST)
\r
21 X-AuditID: 1209190f-b7fec6d00000090d-3b-50cc076f383d
\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])
\r
23 by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 20.8B.02317.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-3.mit.edu (8.13.8/8.9.2) with ESMTP id qBF5FQgg030061;
\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 qBF5FOjT011448
\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-0002kZ-Bi; 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 6/7] emacs: Use unified error handling in search
\r
41 Date: Sat, 15 Dec 2012 00:15:12 -0500
\r
42 Message-Id: <1355548513-10085-7-git-send-email-amdragon@mit.edu>
\r
43 X-Mailer: git-send-email 1.7.10.4
\r
44 In-Reply-To: <1355548513-10085-1-git-send-email-amdragon@mit.edu>
\r
45 References: <1355548513-10085-1-git-send-email-amdragon@mit.edu>
\r
46 X-Brightmail-Tracker:
\r
47 H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsUixCmqrZvPfibA4OJ6HYvVc3ksrt+cyezA
\r
48 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZTSc3c9Y8E2yYt3FS8wNjBdEuhg5OSQETCQO
\r
49 rrzKCGGLSVy4t56ti5GLQ0hgH6PE3OM7oZwNjBIrNp5hhnAeMUncPvMFypnLKPH8/TZmkH42
\r
50 AQ2JbfuXg80SEZCW2Hl3NiuIzSzgKPF5/yI2EFtYwEHi8eIV7CA2i4CqxJEHT1lAbF6geO/z
\r
51 GewQdyhKdD+bAFbPCdS77OM5sBohoJqzr+6yTmDkX8DIsIpRNiW3Sjc3MTOnODVZtzg5MS8v
\r
52 tUjXRC83s0QvNaV0EyM4lCT5dzB+O6h0iFGAg1GJh3dHxOkAIdbEsuLK3EOMkhxMSqK8txjO
\r
53 BAjxJeWnVGYkFmfEF5XmpBYfYpTgYFYS4RXbAlTOm5JYWZValA+TkuZgURLnvZpy019IID2x
\r
54 JDU7NbUgtQgmK8PBoSTBy84GNFSwKDU9tSItM6cEIc3EwQkynAdoOBdIDW9xQWJucWY6RP4U
\r
55 o6KUOO8TVqCEAEgiozQPrhcW668YxYFeEeaVB2nnAaYJuO5XQIOZgAbHXToOMrgkESEl1cCY
\r
56 N0GBI+rLPudp23Ljr0UorDTLnRuqdbtu7evwhSGzls2VrelUEpe54Rb7OmH6uZXSypnCh97y
\r
57 c53dIsXqNc2u0NB5+Ye3vMrW7cqvJefw2kzOm90z/daxZ0L3LfPSbB/d/b3+oahhw/95V/8z
\r
58 cJQuTum+F3Jx/czNDt9/f5ulm/zz3qzqlODnSizFGYmGWsxFxYkA988Uh9ACAAA=
\r
59 X-BeenThere: notmuch@notmuchmail.org
\r
60 X-Mailman-Version: 2.1.13
\r
62 List-Id: "Use and development of the notmuch mail system."
\r
63 <notmuch.notmuchmail.org>
\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
67 List-Post: <mailto:notmuch@notmuchmail.org>
\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
70 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
71 X-List-Received-Date: Sat, 15 Dec 2012 05:15:30 -0000
\r
73 This slightly changes the output of an existing test since we now
\r
74 report non-zero exits with a pop-up buffer instead of at the end of
\r
77 emacs/notmuch-lib.el | 13 +++++++++++++
\r
78 emacs/notmuch.el | 13 ++++++++-----
\r
79 test/emacs-large-search-buffer | 2 +-
\r
80 3 files changed, 22 insertions(+), 6 deletions(-)
\r
82 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
83 index 9222de8..cf61635 100644
\r
84 --- a/emacs/notmuch-lib.el
\r
85 +++ b/emacs/notmuch-lib.el
\r
86 @@ -332,6 +332,19 @@ the user dismisses it."
\r
87 (goto-char (point-min))))
\r
88 (pop-to-buffer buf)))
\r
90 +(defun notmuch-check-async-exit-status (proc msg)
\r
91 + "If PROC exited abnormally, pop up an error buffer and signal an error.
\r
93 +This is a wrapper around `notmuch-check-exit-status' for
\r
94 +asynchronous process sentinels. PROC and MSG must be the
\r
95 +arguments passed to the sentinel."
\r
96 + (let ((exit-status
\r
97 + (case (process-status proc)
\r
98 + ((exit) (process-exit-status proc))
\r
100 + (when exit-status
\r
101 + (notmuch-check-exit-status exit-status (process-command proc)))))
\r
103 (defun notmuch-check-exit-status (exit-status command &optional output err-file)
\r
104 "If EXIT-STATUS is non-zero, pop up an error buffer and signal an error.
\r
106 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
107 index e25b54e..c20de13 100644
\r
108 --- a/emacs/notmuch.el
\r
109 +++ b/emacs/notmuch.el
\r
110 @@ -637,6 +637,7 @@ of the result."
\r
111 (exit-status (process-exit-status proc))
\r
112 (never-found-target-thread nil))
\r
113 (when (memq status '(exit signal))
\r
115 (kill-buffer (process-get proc 'parse-buf))
\r
116 (if (buffer-live-p buffer)
\r
117 (with-current-buffer buffer
\r
118 @@ -647,17 +648,19 @@ of the result."
\r
119 (if (eq status 'signal)
\r
120 (insert "Incomplete search results (search process was killed).\n"))
\r
121 (when (eq status 'exit)
\r
122 - (insert "End of search results.")
\r
123 - (unless (= exit-status 0)
\r
124 - (insert (format " (process returned %d)" exit-status)))
\r
126 + (insert "End of search results.\n")
\r
127 + (condition-case err
\r
128 + (notmuch-check-async-exit-status proc msg)
\r
129 + ;; Suppress the error signal since strange
\r
130 + ;; things happen if a sentinel signals.
\r
131 + (error (throw 'return nil)))
\r
133 (not (string= notmuch-search-target-thread "found")))
\r
134 (set 'never-found-target-thread t)))))
\r
135 (when (and never-found-target-thread
\r
136 notmuch-search-target-line)
\r
137 (goto-char (point-min))
\r
138 - (forward-line (1- notmuch-search-target-line))))))))
\r
139 + (forward-line (1- notmuch-search-target-line)))))))))
\r
141 (defcustom notmuch-search-line-faces '(("unread" :weight bold)
\r
142 ("flagged" :foreground "blue"))
\r
143 diff --git a/test/emacs-large-search-buffer b/test/emacs-large-search-buffer
\r
144 index 678328d..9dcbef5 100755
\r
145 --- a/test/emacs-large-search-buffer
\r
146 +++ b/test/emacs-large-search-buffer
\r
147 @@ -36,7 +36,7 @@ test_emacs '(notmuch-search "--this-option-does-not-exist")
\r
148 cat <<EOF >EXPECTED
\r
149 Error: Unexpected output from notmuch search:
\r
150 Unrecognized option: --this-option-does-not-exist
\r
151 -End of search results. (process returned 1)
\r
152 +End of search results.
\r
154 test_expect_equal_file OUTPUT EXPECTED
\r