Re: [PATCH 2/7] emacs: Use unified error handling in notmuch-call-notmuch-process
authorAustin Clements <amdragon@MIT.EDU>
Sat, 15 Dec 2012 19:51:01 +0000 (14:51 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:52:19 +0000 (09:52 -0800)
63/eda2608387185e71200b9f0b47ee3848ee8a10 [new file with mode: 0644]

diff --git a/63/eda2608387185e71200b9f0b47ee3848ee8a10 b/63/eda2608387185e71200b9f0b47ee3848ee8a10
new file mode 100644 (file)
index 0000000..3ecb8ea
--- /dev/null
@@ -0,0 +1,136 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 9059E431FBC\r
+       for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 11:51:04 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id V28ChLbAI2vk for <notmuch@notmuchmail.org>;\r
+       Sat, 15 Dec 2012 11:51:04 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU\r
+       [18.7.68.37])\r
+       by olra.theworths.org (Postfix) with ESMTP id 121FC431FB6\r
+       for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 11:51:03 -0800 (PST)\r
+X-AuditID: 12074425-b7f606d0000008ea-b8-50ccd4a7cf31\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 1A.E8.02282.7A4DCC05; Sat, 15 Dec 2012 14:51:03 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id qBFJp3jO011807; \r
+       Sat, 15 Dec 2012 14:51:03 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qBFJp11R022951\r
+       (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+       Sat, 15 Dec 2012 14:51:02 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1TjxlF-0003FX-4l; Sat, 15 Dec 2012 14:51:01 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 2/7] emacs: Use unified error handling in\r
+       notmuch-call-notmuch-process\r
+In-Reply-To: <876243hdcc.fsf@qmul.ac.uk>\r
+References: <1355548513-10085-1-git-send-email-amdragon@mit.edu>\r
+       <1355548513-10085-3-git-send-email-amdragon@mit.edu>\r
+       <876243hdcc.fsf@qmul.ac.uk>\r
+User-Agent: Notmuch/0.14+184~gc26cc51 (http://notmuchmail.org) Emacs/23.4.1\r
+       (i486-pc-linux-gnu)\r
+Date: Sat, 15 Dec 2012 14:51:01 -0500\r
+Message-ID: <874njnxffe.fsf@awakening.csail.mit.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFnrIIsWRmVeSWpSXmKPExsUixG6nrrv8ypkAg8PXRSxWz+WxuH5zJrMD\r
+       k8fOWXfZPZ6tusUcwBTFZZOSmpNZllqkb5fAlTFhyS72gn0CFW//XWBqYJzM28XIySEhYCKx\r
+       9HIPK4QtJnHh3nq2LkYuDiGBfYwSh7Ysh3I2MEo0TzzGBOFcZJI4PWsnC4SzhFHi1uab7CD9\r
+       bAIaEtv2L2cEsUUEXCWefvvMDGILC0RJLHlxE8zmBKpZN+M1O0TzREaJ1qv3gBo4OEQF4iXO\r
+       LjUBqWERUJV48/AKE4jNC3Tf96m/WCBsQYmTM5+A2cwCWhI3/r1kmsAoMAtJahaS1AJGplWM\r
+       sim5Vbq5iZk5xanJusXJiXl5qUW6Fnq5mSV6qSmlmxjBIemiuoNxwiGlQ4wCHIxKPLw7Ik4H\r
+       CLEmlhVX5h5ilORgUhLlrTh3JkCILyk/pTIjsTgjvqg0J7X4EKMEB7OSCG/SfKAcb0piZVVq\r
+       UT5MSpqDRUmc90bKTX8hgfTEktTs1NSC1CKYrAwHh5IEb8BloEbBotT01Iq0zJwShDQTByfI\r
+       cB6g4awgNbzFBYm5xZnpEPlTjIpS4ryeIAkBkERGaR5cLyxlvGIUB3pFmDcPpIoHmG7gul8B\r
+       DWYCGrzcBmxwSSJCSqqBUfxYVFb0FP/GDRdl/n858/tU1rmIhqSZU48bz99/Tfdy17TTH9Y4\r
+       N8WXzilqW/Lh8+KqqeVfv+T9eVQmzKGv8yruNPMR3R/RJaLTkjrkLNyS7100zrI5/88np+bA\r
+       zKSdc296NOft+/h1b6T5panahk6+eZPYPhV9jzjp98m1aXrW5hC/dSf3mSixFGckGmoxFxUn\r
+       AgAkEw7x9AIAAA==\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 15 Dec 2012 19:51:04 -0000\r
+\r
+On Sat, 15 Dec 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
+> On Sat, 15 Dec 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
+>> This makes notmuch-call-notmuch-process use the unified CLI error\r
+>> handling, which basically refines the error handling this function\r
+>> already did.\r
+>> ---\r
+>>  emacs/notmuch.el |   15 ++++-----------\r
+>>  1 file changed, 4 insertions(+), 11 deletions(-)\r
+>>\r
+>> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+>> index f9454d8..e25b54e 100644\r
+>> --- a/emacs/notmuch.el\r
+>> +++ b/emacs/notmuch.el\r
+>> @@ -538,17 +538,10 @@ If BARE is set then do not prefix with \"thread:\""\r
+>>  \r
+>>  Output from the process will be presented to the user as an error\r
+>>  and will also appear in a buffer named \"*Notmuch errors*\"."\r
+>\r
+> This comment looks like it is not true (but wasn't true before\r
+> either). I think output will only be presented to the user if notmuch\r
+> exits with a non-zero status?\r
+\r
+Fixed.\r
+\r
+>> -  (let ((error-buffer (get-buffer-create "*Notmuch errors*")))\r
+>> -    (with-current-buffer error-buffer\r
+>> -   (erase-buffer))\r
+>> -    (if (eq (apply 'call-process notmuch-command nil error-buffer nil args) 0)\r
+>> -   (point)\r
+>> -      (progn\r
+>> -   (with-current-buffer error-buffer\r
+>> -     (let ((beg (point-min))\r
+>> -           (end (- (point-max) 1)))\r
+>> -       (error (buffer-substring beg end))\r
+>> -       ))))))\r
+>> +  (with-temp-buffer\r
+>> +    (let ((status (apply #'call-process notmuch-command nil t nil args)))\r
+>> +      (notmuch-check-exit-status status (cons notmuch-command args)\r
+>> +                            (buffer-string)))))\r
+>>  \r
+>\r
+> Would it be worth separating stderr and stdout here? (Quite plausibly it\r
+> isn't.)\r
+\r
+Actually I think it's better to not separate stdout and stderr when we\r
+can avoid it, since stdout may give context for what's on stderr.  When\r
+we're trying to interpret stdout it's important to separate it, but\r
+that's not the case here.\r
+\r
+> Best wishes\r
+>\r
+> Mark\r
+>\r
+>\r
+>>  (defun notmuch-search-set-tags (tags &optional pos)\r
+>>    (let ((new-result (plist-put (notmuch-search-get-result pos) :tags tags)))\r
+>> -- \r
+>> 1.7.10.4\r