From: Mark Walters Date: Mon, 24 Jun 2013 19:00:27 +0000 (+0100) Subject: Re: [PATCH 1/3] emacs: Introduce `notmuch-call-notmuch-sexp' X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=15652979012d167e5bd35133955953530ba4edea;p=notmuch-archives.git Re: [PATCH 1/3] emacs: Introduce `notmuch-call-notmuch-sexp' --- diff --git a/23/b77bde0a338b1b2a2cf3856b45829b343e3cbd b/23/b77bde0a338b1b2a2cf3856b45829b343e3cbd new file mode 100644 index 000000000..4173ffd28 --- /dev/null +++ b/23/b77bde0a338b1b2a2cf3856b45829b343e3cbd @@ -0,0 +1,123 @@ +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 DC443431FB6 + for ; Mon, 24 Jun 2013 12:00:43 -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 xpG0l+gAY5tc for ; + Mon, 24 Jun 2013 12:00:37 -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 32A8B431FAF + for ; Mon, 24 Jun 2013 12:00:37 -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 1UrC05-0003X9-C9; Mon, 24 Jun 2013 20:00:31 +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 1UrC05-0000qb-2I; Mon, 24 Jun 2013 20:00:29 +0100 +From: Mark Walters +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH 1/3] emacs: Introduce `notmuch-call-notmuch-sexp' +In-Reply-To: <1372030999-1262-1-git-send-email-amdragon@mit.edu> +References: <1372030999-1262-1-git-send-email-amdragon@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:00:27 +0100 +Message-ID: <87zjuftjuc.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: 72b9b4d76cd066658c9a358d59c51247 (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 +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:00:44 -0000 + + +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. +> +> -- +> 1.7.10.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch