From 906a587ab72f8f8e5daeb85422cdd1d0e74ef920 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Mon, 24 Jun 2013 18:35:50 +0300 Subject: [PATCH] Re: [PATCH 1/3] emacs: Introduce `notmuch-call-notmuch-sexp' --- 5d/05fa42b293355d7d66190e8d834805e3d9b5b4 | 101 ++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 5d/05fa42b293355d7d66190e8d834805e3d9b5b4 diff --git a/5d/05fa42b293355d7d66190e8d834805e3d9b5b4 b/5d/05fa42b293355d7d66190e8d834805e3d9b5b4 new file mode 100644 index 000000000..33a57135d --- /dev/null +++ b/5d/05fa42b293355d7d66190e8d834805e3d9b5b4 @@ -0,0 +1,101 @@ +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 1CB08431FC2 + for ; Mon, 24 Jun 2013 08:36:10 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 v5FVd7ADOzLf for ; + Mon, 24 Jun 2013 08:36:00 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id C2AC5431FAF + for ; Mon, 24 Jun 2013 08:35:59 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 79C39100094; + Mon, 24 Jun 2013 18:35:50 +0300 (EEST) +From: Tomi Ollila +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+186~ga3c514a (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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 15:36:10 -0000 + +On Mon, Jun 24 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. +> --- + +This series looks good (if not trivial), works in use and tests pass. +1 + +Tomi + + +> 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 -- 2.26.2