From ee07016dde97fd3e8fe007d8c472eb014f92448b Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 24 Jun 2013 19:43:17 +2000 Subject: [PATCH] [PATCH 1/3] emacs: Introduce `notmuch-call-notmuch-sexp' --- 54/c4eb75773b2bcfcd8013ae6acb9d68a2786f52 | 109 ++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 54/c4eb75773b2bcfcd8013ae6acb9d68a2786f52 diff --git a/54/c4eb75773b2bcfcd8013ae6acb9d68a2786f52 b/54/c4eb75773b2bcfcd8013ae6acb9d68a2786f52 new file mode 100644 index 000000000..f698d9918 --- /dev/null +++ b/54/c4eb75773b2bcfcd8013ae6acb9d68a2786f52 @@ -0,0 +1,109 @@ +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 0FCC2431FBD + for ; Sun, 23 Jun 2013 16:43:36 -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 fJX5Tr3ysuqp for ; + Sun, 23 Jun 2013 16:43:28 -0700 (PDT) +Received: from dmz-mailsec-scanner-7.mit.edu (dmz-mailsec-scanner-7.mit.edu + [18.7.68.36]) + by olra.theworths.org (Postfix) with ESMTP id 0760A431FAF + for ; Sun, 23 Jun 2013 16:43:27 -0700 (PDT) +X-AuditID: 12074424-b7f228e00000096b-be-51c7881f64e1 +Received: from mailhub-auth-4.mit.edu ( [18.7.62.39]) + by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP + id 6D.0C.02411.F1887C15; Sun, 23 Jun 2013 19:43:27 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r5NNhPne024474; + Sun, 23 Jun 2013 19:43:26 -0400 +Received: from drake.dyndns.org + (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com + [216.15.114.40]) (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r5NNhNmA023367 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Sun, 23 Jun 2013 19:43:25 -0400 +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1UqtwJ-0000L2-Td; Sun, 23 Jun 2013 19:43:23 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH 1/3] emacs: Introduce `notmuch-call-notmuch-sexp' +Date: Sun, 23 Jun 2013 19:43:17 -0400 +Message-Id: <1372030999-1262-1-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.7.10.4 +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFprFIsWRmVeSWpSXmKPExsUixG6nrivfcTzQ4PsrVYvrN2cyOzB6PFt1 + izmAMYrLJiU1J7MstUjfLoEr49euA2wFZ7kq/nZeYm5gPMjRxcjJISFgIjH58kVGCFtM4sK9 + 9WxdjFwcQgL7GCX+nvvPAuFsZJRYOWEyI4Rzh0li38ZeqMxcRokpX38xgfSzCWhIbNu/HGyW + iIC0xM67s1m7GDk4mAXUJP50qYCEhQUcJc4fXQsWZhFQlXi+NAUkzCtgL3H8zCw2iCsUJbqf + TWCbwMi7gJFhFaNsSm6Vbm5iZk5xarJucXJiXl5qka65Xm5miV5qSukmRnAQuKjsYGw+pHSI + UYCDUYmH94fl8UAh1sSy4srcQ4ySHExKorznW4BCfEn5KZUZicUZ8UWlOanFhxglOJiVRHh7 + rYByvCmJlVWpRfkwKWkOFiVxXrFbOwOFBNITS1KzU1MLUotgsjIcHEoSvNvagBoFi1LTUyvS + MnNKENJMHJwgw3mAhh8DqeEtLkjMLc5Mh8ifYlSUEufdA5IQAElklObB9cKi9BWjONArwrwX + Qap4gBEO1/0KaDAT0ODJqWCDSxIRUlINjO2Xa47Z/Sr8XxK8Uu1jecqhfP+1s/bvEPx9baKT + 0JT3L8MnWTI+5fsadXTRNOZSUd7EpjVTgwyuSsbPTNWaq9k1Nc5sUuq2ywHbPke7WXubTnTf + tHdRp+GGyjIDU47yM13W03oW/2RaNcFPMW55TtPOPOXJTSylep0nneeHTLlpz+ftWHWjTYml + OCPRUIu5qDgRAG0c9xitAgAA +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: Sun, 23 Jun 2013 23:43:36 -0000 + +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 + -- 2.26.2