1 Return-Path: <amdragon@mit.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 0EF1E431FC0
\r
6 for <notmuch@notmuchmail.org>; Sat, 8 Dec 2012 16:47:44 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 9ft3CFF5-6D0 for <notmuch@notmuchmail.org>;
\r
16 Sat, 8 Dec 2012 16:47:43 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 72A63431FAE
\r
20 for <notmuch@notmuchmail.org>; Sat, 8 Dec 2012 16:47:43 -0800 (PST)
\r
21 X-AuditID: 1209190c-b7f886d000000936-a2-50c3dfae5061
\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
23 by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id E3.95.02358.EAFD3C05; Sat, 8 Dec 2012 19:47:42 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id qB90lf4G017333;
\r
27 Sat, 8 Dec 2012 19:47:42 -0500
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qB90lecM014120
\r
32 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);
\r
33 Sat, 8 Dec 2012 19:47:41 -0500 (EST)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1ThV3T-0005cB-Qx; Sat, 08 Dec 2012 19:47:39 -0500
\r
37 Date: Sat, 8 Dec 2012 19:47:39 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Mark Walters <markwalters1009@gmail.com>
\r
40 Subject: Re: [PATCH] emacs: query: make sync queries use sexp
\r
41 Message-ID: <20121209004739.GH4422@mit.edu>
\r
42 References: <1354975891-24663-1-git-send-email-markwalters1009@gmail.com>
\r
44 Content-Type: text/plain; charset=us-ascii
\r
45 Content-Disposition: inline
\r
46 In-Reply-To: <1354975891-24663-1-git-send-email-markwalters1009@gmail.com>
\r
47 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
48 X-Brightmail-Tracker:
\r
49 H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IRYrdT1113/3CAwckrmhar5/JYXL85k9mB
\r
50 yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgymh7sICt4LtoxcU/K1kaGLcLdjFyckgImEis
\r
51 u7SPFcIWk7hwbz1bFyMXh5DAPkaJR4++skM46xklfr++wwrhXGCSOLz+MVTZEkaJDStes4P0
\r
52 swioSCzePxtsFpuAhsS2/csZQWwRAR2J24cWgNUwC0hLfPvdzARiCwvYSqx7d4oNxOYV0Jb4
\r
53 t3YZWFxIwFOif+scZoi4oMTJmU9YIHq1JG78ewlUwwE2Z/k/DpAwp4CXxNsZx8BaRYFOmHJy
\r
54 G9sERqFZSLpnIemehdC9gJF5FaNsSm6Vbm5iZk5xarJucXJiXl5qka6hXm5miV5qSukmRlBY
\r
55 c0ry7GB8c1DpEKMAB6MSD2/H7cMBQqyJZcWVuYcYJTmYlER594OE+JLyUyozEosz4otKc1KL
\r
56 DzFKcDArifC+LAfK8aYkVlalFuXDpKQ5WJTEeS+n3PQXEkhPLEnNTk0tSC2CycpwcChJ8F67
\r
57 B9QoWJSanlqRlplTgpBm4uAEGc4DNPwMSA1vcUFibnFmOkT+FKOilDjvXpCEAEgiozQPrheW
\r
58 dl4xigO9Isy7EKSKB5iy4LpfAQ1mAhp8UhBscEkiQkqqgVE8e43cbXYW9es5zXM+h1sonY+u
\r
59 Nl2xXujZ0XvHj7C/Mfl6Xys8k6e2p28Td4a2Wq197Z/P6ZUc6Uf4kl8uvRQy7aCfz/TrEQ21
\r
60 kSc5tN794ZRfJJaqvTCEkWXv/02ugkqWmQkzMyf/vLjs4k+h2fN1L+28phja/T/Ml/GSUMv/
\r
61 iA2/3x0ufKTEUpyRaKjFXFScCAAtTNGaFgMAAA==
\r
62 Cc: notmuch@notmuchmail.org
\r
63 X-BeenThere: notmuch@notmuchmail.org
\r
64 X-Mailman-Version: 2.1.13
\r
66 List-Id: "Use and development of the notmuch mail system."
\r
67 <notmuch.notmuchmail.org>
\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
69 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
71 List-Post: <mailto:notmuch@notmuchmail.org>
\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
74 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
75 X-List-Received-Date: Sun, 09 Dec 2012 00:47:44 -0000
\r
77 sexp-at-point is a pretty roundabout way to parse this that I think
\r
78 will basically parse the S-expression three times (in end-of-sexp, in
\r
79 beginning-of-sexp, and then for real in read-from-whole-string). How
\r
83 (read (current-buffer))
\r
84 (skip-chars-forward " \t\n\f")
\r
86 (error "Trailing garbage after notmuch output")))
\r
88 ? Technically, just the (read (current-buffer)) part would be
\r
89 equivalent to the current (json-read) call (which will ignore any
\r
92 There's also another synchronous JSON query in notmuch-mua.el that
\r
95 I wouldn't worry too much about the error handling. I don't think
\r
96 this can deal worse with errors than the current JSON code does. My
\r
97 schema versioning series has a patch [1] that should help improve
\r
98 error handling. It's for JSON right now, but will be trivial to port
\r
101 [1] id:1354416002-3557-9-git-send-email-amdragon@mit.edu
\r
103 Quoth Mark Walters on Dec 08 at 2:11 pm:
\r
104 > This changes the queries used by notmuch-show from json to sexp (patch
\r
105 > based on a comment by Tomi on irc as to the trivial change needed).
\r
107 > The async query parsed used by search is not as easy to convert.
\r
110 > It's probably worth making this change: sexps are significantly faster
\r
111 > but I doubt anyone would notice in show (since the query is small and
\r
112 > the wash processing etc relatively large).
\r
114 > At the moment this doesn't do any error fixing. The json version did
\r
115 > not either but the sexp parser and the json parser might behave
\r
116 > differently on malformed input.
\r
123 > emacs/notmuch-query.el | 7 ++-----
\r
124 > 1 files changed, 2 insertions(+), 5 deletions(-)
\r
126 > diff --git a/emacs/notmuch-query.el b/emacs/notmuch-query.el
\r
127 > index d66baea..0ee6cca 100644
\r
128 > --- a/emacs/notmuch-query.el
\r
129 > +++ b/emacs/notmuch-query.el
\r
130 > @@ -29,10 +29,7 @@ A thread is a forest or list of trees. A tree is a two element
\r
131 > list where the first element is a message, and the second element
\r
132 > is a possibly empty forest of replies.
\r
134 > - (let ((args '("show" "--format=json"))
\r
135 > - (json-object-type 'plist)
\r
136 > - (json-array-type 'list)
\r
137 > - (json-false 'nil))
\r
138 > + (let ((args '("show" "--format=sexp")))
\r
139 > (if notmuch-show-process-crypto
\r
140 > (setq args (append args '("--decrypt"))))
\r
141 > (setq args (append args search-terms))
\r
142 > @@ -40,7 +37,7 @@ is a possibly empty forest of replies.
\r
144 > (apply 'call-process (append (list notmuch-command nil (list t nil) nil) args))
\r
145 > (goto-char (point-min))
\r
146 > - (json-read)))))
\r
147 > + (sexp-at-point)))))
\r
149 > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
\r
150 > ;; Mapping functions across collections of messages.
\r