[PATCH] emacs: query: make sync queries use sexp
authorMark Walters <markwalters1009@gmail.com>
Sat, 8 Dec 2012 14:11:31 +0000 (14:11 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:51:47 +0000 (09:51 -0800)
63/faf42bb2e49d2198d86acdd35ae17bb28c41f1 [new file with mode: 0644]

diff --git a/63/faf42bb2e49d2198d86acdd35ae17bb28c41f1 b/63/faf42bb2e49d2198d86acdd35ae17bb28c41f1
new file mode 100644 (file)
index 0000000..4712975
--- /dev/null
@@ -0,0 +1,110 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 24FF0431FCB\r
+       for <notmuch@notmuchmail.org>; Sat,  8 Dec 2012 06:11:38 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id XeEkKIeLvs+F for <notmuch@notmuchmail.org>;\r
+       Sat,  8 Dec 2012 06:11:37 -0800 (PST)\r
+Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com\r
+ [74.125.82.47])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ 8394A431FBF   for <notmuch@notmuchmail.org>; Sat,  8 Dec 2012 06:11:37 -0800\r
+ (PST)\r
+Received: by mail-wg0-f47.google.com with SMTP id dq11so724139wgb.2\r
+       for <notmuch@notmuchmail.org>; Sat, 08 Dec 2012 06:11:36 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer;\r
+       bh=yf1LX5+eSN2+UPY3KYQbezY3LVH8axFrIujfRu0SKWo=;\r
+       b=J1YL+qJohGI6qCHoodAGVRWOxgxfMDv29i6URJIxehWlVstJe1Z4FGicRdKQJfsDhG\r
+       uZozXhkkb4UP9z7U87kHIQWAjj+Wum2fY+JzeSlLPV/CncNuJ6Bk3N7RZTTNf/0jVDM+\r
+       gu+oaEcyV1LJc4jAZaL0RBn6y2UhDpRDozvVuKLdclZO8/AK3urlni6hZry+l+/2PIYr\r
+       a/THDe6V7zg6Td2eSoQUahoxvcvSF6Dob2pumwKTWiHv3Q2T3rt7xZgdAurhbn590WIF\r
+       fxAiISlvdhfDL8iGcWd77WqVALP2DZpq666OS1Ptao2Q0agX7oRPmPV3FK9sQw+8So+b\r
+       TunA==\r
+Received: by 10.180.72.232 with SMTP id g8mr3249555wiv.0.1354975896317;\r
+       Sat, 08 Dec 2012 06:11:36 -0800 (PST)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+       by mx.google.com with ESMTPS id i6sm2315480wix.5.2012.12.08.06.11.34\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sat, 08 Dec 2012 06:11:35 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: query: make sync queries use sexp\r
+Date: Sat,  8 Dec 2012 14:11:31 +0000\r
+Message-Id: <1354975891-24663-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 08 Dec 2012 14:11:38 -0000\r
+\r
+This changes the queries used by notmuch-show from json to sexp (patch\r
+based on a comment by Tomi on irc as to the trivial change needed).\r
+\r
+The async query parsed used by search is not as easy to convert.\r
+---\r
+\r
+It's probably worth making this change: sexps are significantly faster\r
+but I doubt anyone would notice in show (since the query is small and\r
+the wash processing etc relatively large).\r
+\r
+At the moment this doesn't do any error fixing. The json version did\r
+not either but the sexp parser and the json parser might behave\r
+differently on malformed input.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+ emacs/notmuch-query.el |    7 ++-----\r
+ 1 files changed, 2 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-query.el b/emacs/notmuch-query.el\r
+index d66baea..0ee6cca 100644\r
+--- a/emacs/notmuch-query.el\r
++++ b/emacs/notmuch-query.el\r
+@@ -29,10 +29,7 @@ A thread is a forest or list of trees. A tree is a two element\r
+ list where the first element is a message, and the second element\r
+ is a possibly empty forest of replies.\r
+ "\r
+-  (let  ((args '("show" "--format=json"))\r
+-       (json-object-type 'plist)\r
+-       (json-array-type 'list)\r
+-       (json-false 'nil))\r
++  (let  ((args '("show" "--format=sexp")))\r
+     (if notmuch-show-process-crypto\r
+       (setq args (append args '("--decrypt"))))\r
+     (setq args (append args search-terms))\r
+@@ -40,7 +37,7 @@ is a possibly empty forest of replies.\r
+       (progn\r
+       (apply 'call-process (append (list notmuch-command nil (list t nil) nil) args))\r
+       (goto-char (point-min))\r
+-      (json-read)))))\r
++      (sexp-at-point)))))\r
\r
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
+ ;; Mapping functions across collections of messages.\r
+-- \r
+1.7.9.1\r
+\r