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 3701B431FBD for ; Mon, 24 Jun 2013 12:11:45 -0700 (PDT) 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 8k452kYCOqN7 for ; Mon, 24 Jun 2013 12:11:36 -0700 (PDT) Received: from dmz-mailsec-scanner-3.mit.edu (dmz-mailsec-scanner-3.mit.edu [18.9.25.14]) by olra.theworths.org (Postfix) with ESMTP id 4CD73431FAF for ; Mon, 24 Jun 2013 12:11:36 -0700 (PDT) X-AuditID: 1209190e-b7f988e0000009a7-38-51c899e7f14f Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP id 3D.F4.02471.7E998C15; Mon, 24 Jun 2013 15:11:35 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r5OJBP7f013758; Mon, 24 Jun 2013 15:11:35 -0400 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.8/8.12.4) with ESMTP id r5OJBIn2020025 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 24 Jun 2013 15:11:19 -0400 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) (envelope-from ) id 1UrCAX-00049U-40; Mon, 24 Jun 2013 15:11:17 -0400 Date: Mon, 24 Jun 2013 15:11:16 -0400 From: Austin Clements To: Mark Walters Subject: Re: [PATCH 1/3] emacs: Introduce `notmuch-call-notmuch-sexp' Message-ID: <20130624191115.GB2214@mit.edu> References: <1372030999-1262-1-git-send-email-amdragon@mit.edu> <87zjuftjuc.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87zjuftjuc.fsf@qmul.ac.uk> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42IR4hTV1n0+80SgweltFhar5/JYXL85k9mB yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgyrhwYD1LwW7BiumfJBoYj/F2MXJySAiYSJz5 d5cZwhaTuHBvPRuILSSwj1Fi/hTXLkYuIHsjo8Tl1jnMEM5pJolXZx6wQzhLGCVO7N7NBNLC IqAqsW//MXYQm01AQ2Lb/uWMILaIgI7E7UMLwOLMAtIS3343g9ULC7hKdM1cxQpi8wpoS8yd fJEJYnWsxM1NV5kh4oISJ2c+YYHo1ZK48e8lUA0H2Jzl/zhAwpxAqw59vwrWKiqgIjHl5Da2 CYxCs5B0z0LSPQuhewEj8ypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdY73czBK91JTSTYzgkJbk 28H49aDSIUYBDkYlHt4ZMScChVgTy4orcw8xSnIwKYnyfp8OFOJLyk+pzEgszogvKs1JLT7E KMHBrCTCGyoClONNSaysSi3Kh0lJc7AoifOK3toZKCSQnliSmp2aWpBaBJOV4eBQkuBdNQOo UbAoNT21Ii0zpwQhzcTBCTKcB2h4D0gNb3FBYm5xZjpE/hSjopQ471eQhABIIqM0D64XlnJe MYoDvSLMyw1MQEI8wHQF1/0KaDAT0ODJqcdBBpckIqSkGhgDSlm1er9O35u/Svf9uUddmSGn /koZmL7Y9VM/kYOzUPme686u7GUXJuUfnC8VvEZY9+TfKu8PZ2/dqV15ySJ3N4dhPe/ZO+Kv vD4tO3/xTUPKAc7eOOsb9dudHa3KUm531uh0Nzw3uzvLIPT7CdUdN/5lGa5Jc3syb87ddK/r 64/v3OJhe75JiaU4I9FQi7moOBEAgdalhRQDAAA= Cc: notmuch@notmuchmail.org 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: Mon, 24 Jun 2013 19:11:45 -0000 Yes, and thanks for reminding me about the require's. I'll do that in a follow up. I was thinking of just moving the streaming JSON parser to a repo on my GitHub account, since maybe somebody some day will find a use for it, or at least take inspiration from the API (I looked into streaming JSON parser APIs before embarking on that one and they're all terrible!) Mark, you're the only other person who has touched that code. Is this plan good with you? Quoth Mark Walters on Jun 24 at 8:00 pm: > > This series looks good to me +1. > > Is it worth removing all the json (3 files with (require 'json) and the > async json parser) too? > > Best wishes > > Mark > > On Mon, 24 Jun 2013, Austin Clements wrote: > > This is just like `notmuch-call-notmuch-json', but parses S-expression > > output. Note that, also like `notmuch-call-notmuch-json', this > > doesn't consider trailing data to be an error, which may or may not be > > what we want in the long run. > > --- > > emacs/notmuch-lib.el | 17 +++++++++++++++++ > > 1 file changed, 17 insertions(+) > > > > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el > > index 534f217..36eacc1 100644 > > --- a/emacs/notmuch-lib.el > > +++ b/emacs/notmuch-lib.el > > @@ -484,6 +484,23 @@ an error." > > (json-read))) > > (delete-file err-file))))) > > > > +(defun notmuch-call-notmuch-sexp (&rest args) > > + "Invoke `notmuch-command' with ARGS and return the parsed S-exp output. > > + > > +If notmuch exits with a non-zero status, this will pop up a > > +buffer containing notmuch's output and signal an error." > > + > > + (with-temp-buffer > > + (let ((err-file (make-temp-file "nmerr"))) > > + (unwind-protect > > + (let ((status (apply #'call-process > > + notmuch-command nil (list t err-file) nil args))) > > + (notmuch-check-exit-status status (cons notmuch-command args) > > + (buffer-string) err-file) > > + (goto-char (point-min)) > > + (read (current-buffer))) > > + (delete-file err-file))))) > > + > > (defun notmuch-start-notmuch (name buffer sentinel &rest args) > > "Start and return an asynchronous notmuch command.