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