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 127DD431FB6 for ; Mon, 24 Jun 2013 12:29:47 -0700 (PDT) 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 go8QDVC32lye for ; Mon, 24 Jun 2013 12:29:39 -0700 (PDT) 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 EDA6A431FAF for ; Mon, 24 Jun 2013 12:29:38 -0700 (PDT) Received: from smtp.qmul.ac.uk ([138.37.6.40]) by mail2.qmul.ac.uk with esmtp (Exim 4.71) (envelope-from ) id 1UrCSH-00024D-6O; Mon, 24 Jun 2013 20:29:37 +0100 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.71) (envelope-from ) id 1UrCSG-0005M3-T4; Mon, 24 Jun 2013 20:29:37 +0100 From: Mark Walters To: Austin Clements Subject: Re: [PATCH 1/3] emacs: Introduce `notmuch-call-notmuch-sexp' In-Reply-To: <20130624191115.GB2214@mit.edu> References: <1372030999-1262-1-git-send-email-amdragon@mit.edu> <87zjuftjuc.fsf@qmul.ac.uk> <20130624191115.GB2214@mit.edu> User-Agent: Notmuch/0.15.2+171~ge2f30a2 (http://notmuchmail.org) Emacs/23.4.1 (x86_64-pc-linux-gnu) Date: Mon, 24 Jun 2013 20:29:35 +0100 Message-ID: <87sj07tihs.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: 04fc758cdd527537c2a7291ded30bff4 (of first 20000 bytes) X-SpamAssassin-Score: -0.0 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 -0.0 points. Summary of the scoring: * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (markwalters1009[at]gmail.com) * -0.0 AWL AWL: From: address is in the auto white-list X-QM-Scan-Virus: ClamAV says the message is clean 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:29:47 -0000 That is fine. (I think I only moved your code from one file to another but in any case what you suggest is fine.) Best wishes Mark On Mon, 24 Jun 2013, Austin Clements wrote: > 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.