unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH] emacs: query: make sync queries use sexp
Date: Sat,  8 Dec 2012 14:11:31 +0000	[thread overview]
Message-ID: <1354975891-24663-1-git-send-email-markwalters1009@gmail.com> (raw)

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

             reply	other threads:[~2012-12-08 14:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-08 14:11 Mark Walters [this message]
2012-12-09  0:47 ` [PATCH] emacs: query: make sync queries use sexp Austin Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354975891-24663-1-git-send-email-markwalters1009@gmail.com \
    --to=markwalters1009@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).