unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: query: make sync queries use sexp
@ 2012-12-08 14:11 Mark Walters
  2012-12-09  0:47 ` Austin Clements
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Walters @ 2012-12-08 14:11 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-09  0:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-08 14:11 [PATCH] emacs: query: make sync queries use sexp Mark Walters
2012-12-09  0:47 ` Austin Clements

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).