Re: Avoiding the "huge INBOX of death"
[notmuch-archives.git] / 57 / 653c96e76380df1425b0f8170d4f7a136c416b
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 92384431FBC\r
6         for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 11:52:54 -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 6HQ8kLnDd7K5 for <notmuch@notmuchmail.org>;\r
16         Sat, 15 Dec 2012 11:52:54 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
18         [18.9.25.12])\r
19         by olra.theworths.org (Postfix) with ESMTP id 8AF47431FB6\r
20         for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 11:52:53 -0800 (PST)\r
21 X-AuditID: 1209190c-b7f886d000000936-b3-50ccd514e927\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 64.5D.02358.415DCC05; Sat, 15 Dec 2012 14:52:52 -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 qBFJqqXL011960; \r
27         Sat, 15 Dec 2012 14:52:52 -0500\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qBFJqp52023171\r
32         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
33         Sat, 15 Dec 2012 14:52:52 -0500 (EST)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1Tjxn1-0003Fn-2L; Sat, 15 Dec 2012 14:52:51 -0500\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
39 Subject: Re: [PATCH 6/7] emacs: Use unified error handling in search\r
40 In-Reply-To: <8738z7hd6x.fsf@qmul.ac.uk>\r
41 References: <1355548513-10085-1-git-send-email-amdragon@mit.edu>\r
42         <1355548513-10085-7-git-send-email-amdragon@mit.edu>\r
43         <8738z7hd6x.fsf@qmul.ac.uk>\r
44 User-Agent: Notmuch/0.14+184~gc26cc51 (http://notmuchmail.org) Emacs/23.4.1\r
45         (i486-pc-linux-gnu)\r
46 Date: Sat, 15 Dec 2012 14:52:51 -0500\r
47 Message-ID: <871uerxfcc.fsf@awakening.csail.mit.edu>\r
48 MIME-Version: 1.0\r
49 Content-Type: text/plain; charset=us-ascii\r
50 X-Brightmail-Tracker:\r
51  H4sIAAAAAAAAA+NgFnrIIsWRmVeSWpSXmKPExsUixG6nrity9UyAwarVlhar5/JYXL85k9mB\r
52         yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgyjj8fBdLwUv5itt/FrA2ME6Q7GLk5JAQMJF4\r
53         8WsXC4QtJnHh3nq2LkYuDiGBfYwSZ1cvZIVwNjBK7FzwkBHCucgkseDFHSYIZwmjxOu329lB\r
54         +tkENCS27V/OCGKLCLhKPP32mRnEFhZwkbiysR8szglUc+HbQWaI5omMEv86jgIt5OAQFYiX\r
55         OLvUBKSGRUBV4sm6OUwgNi/QfXO7VzFC2IISJ2c+AbuVWUBL4sa/l0wTGAVmIUnNQpJawMi0\r
56         ilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdQLzezRC81pXQTIygkOSV5djC+Oah0iFGAg1GJh3dH\r
57         xOkAIdbEsuLK3EOMkhxMSqK8GZfPBAjxJeWnVGYkFmfEF5XmpBYfYpTgYFYS4U2aD5TjTUms\r
58         rEotyodJSXOwKInzXk656S8kkJ5YkpqdmlqQWgSTleHgUJLgdbgC1ChYlJqeWpGWmVOCkGbi\r
59         4AQZzgM03BSkhre4IDG3ODMdIn+KUVFKnFcAJCEAksgozYPrhaWMV4ziQK8I8yqCVPEA0w1c\r
60         9yugwUxAg5fbgA0uSURISTUw1nV8Oyz4+fvz+247bvK/DlVZ9991GkvMIoOU+V6flzG27Xua\r
61         ptN3Koi3cNc61i6Fy1f12eYZivSZLpnVHfn2w/p1fM3rz7e6FScUpzDLy39MdJle3FPN8NPE\r
62         N8kk2cR2Wdcpe6UFJcoVmSmHksXmechejPf9tDFDzX5N6ibbkK1xlky9LT5KLMUZiYZazEXF\r
63         iQAfg6oT9AIAAA==\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\r
67 List-Id: "Use and development of the notmuch mail system."\r
68         <notmuch.notmuchmail.org>\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
72 List-Post: <mailto:notmuch@notmuchmail.org>\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
76 X-List-Received-Date: Sat, 15 Dec 2012 19:52:54 -0000\r
77 \r
78 On Sat, 15 Dec 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
79 > On Sat, 15 Dec 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
80 >> This slightly changes the output of an existing test since we now\r
81 >> report non-zero exits with a pop-up buffer instead of at the end of\r
82 >> the search results.\r
83 >> ---\r
84 >>  emacs/notmuch-lib.el           |   13 +++++++++++++\r
85 >>  emacs/notmuch.el               |   13 ++++++++-----\r
86 >>  test/emacs-large-search-buffer |    2 +-\r
87 >>  3 files changed, 22 insertions(+), 6 deletions(-)\r
88 >>\r
89 >> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
90 >> index 9222de8..cf61635 100644\r
91 >> --- a/emacs/notmuch-lib.el\r
92 >> +++ b/emacs/notmuch-lib.el\r
93 >> @@ -332,6 +332,19 @@ the user dismisses it."\r
94 >>      (goto-char (point-min))))\r
95 >>      (pop-to-buffer buf)))\r
96 >>  \r
97 >> +(defun notmuch-check-async-exit-status (proc msg)\r
98 >> +  "If PROC exited abnormally, pop up an error buffer and signal an error.\r
99 >> +\r
100 >> +This is a wrapper around `notmuch-check-exit-status' for\r
101 >> +asynchronous process sentinels.  PROC and MSG must be the\r
102 >> +arguments passed to the sentinel."\r
103 >> +  (let ((exit-status\r
104 >> +     (case (process-status proc)\r
105 >> +       ((exit) (process-exit-status proc))\r
106 >> +       ((signal) msg))))\r
107 >> +    (when exit-status\r
108 >> +      (notmuch-check-exit-status exit-status (process-command proc)))))\r
109 >> +\r
110 >>  (defun notmuch-check-exit-status (exit-status command &optional output err-file)\r
111 >>    "If EXIT-STATUS is non-zero, pop up an error buffer and signal an error.\r
112 >>  \r
113 >> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
114 >> index e25b54e..c20de13 100644\r
115 >> --- a/emacs/notmuch.el\r
116 >> +++ b/emacs/notmuch.el\r
117 >> @@ -637,6 +637,7 @@ of the result."\r
118 >>      (exit-status (process-exit-status proc))\r
119 >>      (never-found-target-thread nil))\r
120 >>      (when (memq status '(exit signal))\r
121 >> +      (catch 'return\r
122 >>      (kill-buffer (process-get proc 'parse-buf))\r
123 >>      (if (buffer-live-p buffer)\r
124 >>          (with-current-buffer buffer\r
125 >> @@ -647,17 +648,19 @@ of the result."\r
126 >>                (if (eq status 'signal)\r
127 >>                    (insert "Incomplete search results (search process was killed).\n"))\r
128 >>                (when (eq status 'exit)\r
129 >> -                (insert "End of search results.")\r
130 >> -                (unless (= exit-status 0)\r
131 >> -                  (insert (format " (process returned %d)" exit-status)))\r
132 >> -                (insert "\n")\r
133 >> +                (insert "End of search results.\n")\r
134 >> +                (condition-case err\r
135 >> +                    (notmuch-check-async-exit-status proc msg)\r
136 >> +                  ;; Suppress the error signal since strange\r
137 >> +                  ;; things happen if a sentinel signals.\r
138 >> +                  (error (throw 'return nil)))\r
139 >\r
140 > A total triviality (mostly just to check that I am understanding these\r
141 > parts): is the "err" after the condition-case used/needed?\r
142 \r
143 It's not used or needed.  Syntactically you need something there, of\r
144 course, so I changed it to nil as Tomi suggested, which causes\r
145 condition-case to simply not bind the error value to anything.\r
146 \r
147 > Best wishes\r
148 >\r
149 > Mark\r
150 >>                  (if (and atbob\r
151 >>                           (not (string= notmuch-search-target-thread "found")))\r
152 >>                      (set 'never-found-target-thread t)))))\r
153 >>            (when (and never-found-target-thread\r
154 >>                     notmuch-search-target-line)\r
155 >>                (goto-char (point-min))\r
156 >> -              (forward-line (1- notmuch-search-target-line))))))))\r
157 >> +              (forward-line (1- notmuch-search-target-line)))))))))\r
158 >>  \r
159 >>  (defcustom notmuch-search-line-faces '(("unread" :weight bold)\r
160 >>                                     ("flagged" :foreground "blue"))\r
161 >> diff --git a/test/emacs-large-search-buffer b/test/emacs-large-search-buffer\r
162 >> index 678328d..9dcbef5 100755\r
163 >> --- a/test/emacs-large-search-buffer\r
164 >> +++ b/test/emacs-large-search-buffer\r
165 >> @@ -36,7 +36,7 @@ test_emacs '(notmuch-search "--this-option-does-not-exist")\r
166 >>  cat <<EOF >EXPECTED\r
167 >>  Error: Unexpected output from notmuch search:\r
168 >>  Unrecognized option: --this-option-does-not-exist\r
169 >> -End of search results. (process returned 1)\r
170 >> +End of search results.\r
171 >>  EOF\r
172 >>  test_expect_equal_file OUTPUT EXPECTED\r
173 >>  \r
174 >> -- \r
175 >> 1.7.10.4\r