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 87719431FC0 for ; Sat, 15 Dec 2012 01:30:29 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.098 X-Spam-Level: X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 NkjGX9Lz0rpM for ; Sat, 15 Dec 2012 01:30:29 -0800 (PST) Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E6FEC431FBF for ; Sat, 15 Dec 2012 01:30:28 -0800 (PST) Received: from smtp.qmul.ac.uk ([138.37.6.40]) by mail2.qmul.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1Tjo4g-0006U4-69; Sat, 15 Dec 2012 09:30:26 +0000 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1Tjo4f-0006Z2-Sb; Sat, 15 Dec 2012 09:30:26 +0000 From: Mark Walters To: Austin Clements , notmuch@notmuchmail.org Subject: Re: [PATCH 2/7] emacs: Use unified error handling in notmuch-call-notmuch-process In-Reply-To: <1355548513-10085-3-git-send-email-amdragon@mit.edu> References: <1355548513-10085-1-git-send-email-amdragon@mit.edu> <1355548513-10085-3-git-send-email-amdragon@mit.edu> User-Agent: Notmuch/0.14+155~g7edfdc3 (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Sat, 15 Dec 2012 09:30:27 +0000 Message-ID: <876243hdcc.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Sender-Host-Address: 93.97.24.31 X-QM-SPAM-Info: Sender has good ham record. :) X-QM-Body-MD5: 0459e278710fff784166be989ed900f3 (of first 20000 bytes) X-SpamAssassin-Score: -1.8 X-SpamAssassin-SpamBar: - X-SpamAssassin-Report: The QM spam filters have analysed this message to determine if it is spam. We require at least 5.0 points to mark a message as spam. This message scored -1.8 points. Summary of the scoring: * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, * medium trust * [138.37.6.40 listed in list.dnswl.org] * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * 0.5 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean 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 09:30:29 -0000 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? > - (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.) 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