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