Re: [PATCH] Fix typo in Message.maildir_flags_to_tags
[notmuch-archives.git] / 85 / 019ebe17f65c3272264cd4b89740cc57f4029c
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 531B6429E31\r
6         for <notmuch@notmuchmail.org>; Fri, 31 May 2013 17:40:28 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \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 DQC6wUIk8pOe for <notmuch@notmuchmail.org>;\r
16         Fri, 31 May 2013 17:40:22 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu\r
18         [18.9.25.12])\r
19         by olra.theworths.org (Postfix) with ESMTP id D7A2E431E82\r
20         for <notmuch@notmuchmail.org>; Fri, 31 May 2013 17:40:16 -0700 (PDT)\r
21 X-AuditID: 1209190c-b7f566d000004c69-48-51a942f06008\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 85.73.19561.0F249A15; Fri, 31 May 2013 20:40:16 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id r510eDsq024662; \r
27         Fri, 31 May 2013 20:40:14 -0400\r
28 Received: from drake.dyndns.org (c-76-21-105-205.hsd1.ca.comcast.net\r
29         [76.21.105.205]) (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r510eAvc020947\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Fri, 31 May 2013 20:40:12 -0400\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1UiZrd-0003QY-Li; Fri, 31 May 2013 20:40:09 -0400\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v3 5/6] emacs: Use streaming S-expr parser for search\r
40 Date: Fri, 31 May 2013 20:40:07 -0400\r
41 Message-Id: <1370047208-12785-6-git-send-email-amdragon@mit.edu>\r
42 X-Mailer: git-send-email 1.7.10.4\r
43 In-Reply-To: <1370047208-12785-1-git-send-email-amdragon@mit.edu>\r
44 References: <1370047208-12785-1-git-send-email-amdragon@mit.edu>\r
45 X-Brightmail-Tracker:\r
46  H4sIAAAAAAAAA+NgFjrCIsWRmVeSWpSXmKPExsUixG6novvBaWWgwYoWVYvVc3ksrt+cyWzx\r
47         ZuU8Vgdmj52z7rJ7HP66kMXj2apbzAHMUVw2Kak5mWWpRfp2CVwZz+cqFVyXr3h/+CpjA+Nb\r
48         yS5GTg4JAROJN2+7mSBsMYkL99azdTFycQgJ7GOU+PS7iw0kISSwkVFi1w1OiMRpJon9Dzez\r
49         QyTmMkpMXckIYrMJaEhs278czBYRkJbYeXc2K4jNLBAnsWXKf7C4sICrROvOjcwgNouAqsTM\r
50         6efA5vAKOEhcWNLJDnGFokT3swlgizkFHCXOX/3HDLHLQeLxiZPMExj5FzAyrGKUTcmt0s1N\r
51         zMwpTk3WLU5OzMtLLdI11MvNLNFLTSndxAgKLE5Jnh2Mbw4qHWIU4GBU4uHtWLUiUIg1say4\r
52         MvcQoyQHk5Io72zHlYFCfEn5KZUZicUZ8UWlOanFhxglOJiVRHjz5wCV86YkVlalFuXDpKQ5\r
53         WJTEeS+n3PQXEkhPLEnNTk0tSC2CycpwcChJ8L4EGSpYlJqeWpGWmVOCkGbi4AQZzgM0/BxI\r
54         DW9xQWJucWY6RP4Uo6KUOO8FkIQASCKjNA+uFxb5rxjFgV4R5uUGpgEhHmDSgOt+BTSYCWjw\r
55         E+vlIINLEhFSUg2M+bm631M11HsaZWQelQa4Hwy7PMlDc6Pa2oq4xwqmJ2WmsP4yLo8SNEle\r
56         dOz5IZMPxndSrwnMceD7y1BmuqAzfeayrxvDH891ypk+Z53CpWqnybevRexO4au/XuC4IX3b\r
57         BrXLET/5l0yJWb5I6HxK4Ra2Hg0D7b8NZxdZrXZznTVf+/GDuj4rJZbijERDLeai4kQAuVt/\r
58         cNcCAAA=\r
59 Cc: tomi.ollila@iki.fi\r
60 X-BeenThere: notmuch@notmuchmail.org\r
61 X-Mailman-Version: 2.1.13\r
62 Precedence: list\r
63 List-Id: "Use and development of the notmuch mail system."\r
64         <notmuch.notmuchmail.org>\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
68 List-Post: <mailto:notmuch@notmuchmail.org>\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
72 X-List-Received-Date: Sat, 01 Jun 2013 00:40:28 -0000\r
73 \r
74 In addition to being the Right Thing to do, this noticeably improves\r
75 the time taken to display the first page of search results, since it's\r
76 roughly an order of magnitude faster than the JSON parser.\r
77 Interestingly, it does *not* significantly improve the time to\r
78 completely fill a large search buffer because for large search\r
79 buffers, the cost of creating author invisibility overlays and\r
80 inserting text (which slows down with more overlays) dominates.\r
81 However, the time required to display the first page of results is\r
82 generally more important to the user experience.\r
83 ---\r
84  emacs/notmuch.el |   13 +++----------\r
85  test/emacs       |   10 +++-------\r
86  2 files changed, 6 insertions(+), 17 deletions(-)\r
87 \r
88 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
89 index b8d9c44..5a8c957 100644\r
90 --- a/emacs/notmuch.el\r
91 +++ b/emacs/notmuch.el\r
92 @@ -58,6 +58,7 @@\r
93  (require 'notmuch-hello)\r
94  (require 'notmuch-maildir-fcc)\r
95  (require 'notmuch-message)\r
96 +(require 'notmuch-parser)\r
97  \r
98  (defcustom notmuch-search-result-format\r
99    `(("date" . "%12s ")\r
100 @@ -809,13 +810,6 @@ non-authors is found, assume that all of the authors match."\r
101         (setq notmuch-search-target-thread "found")\r
102         (goto-char beg)))))\r
103  \r
104 -(defun notmuch-search-show-error (string &rest objects)\r
105 -  (save-excursion\r
106 -    (goto-char (point-max))\r
107 -    (insert "Error: Unexpected output from notmuch search:\n")\r
108 -    (insert (apply #'format string objects))\r
109 -    (insert "\n")))\r
110 -\r
111  (defun notmuch-search-process-filter (proc string)\r
112    "Process and filter the output of \"notmuch search\""\r
113    (let ((results-buf (process-buffer proc))\r
114 @@ -829,8 +823,7 @@ non-authors is found, assume that all of the authors match."\r
115         (save-excursion\r
116           (goto-char (point-max))\r
117           (insert string))\r
118 -       (notmuch-json-parse-partial-list 'notmuch-search-show-result\r
119 -                                        'notmuch-search-show-error\r
120 +       (notmuch-sexp-parse-partial-list 'notmuch-search-show-result\r
121                                          results-buf)))))\r
122  \r
123  (defun notmuch-search-tag-all (&optional tag-changes)\r
124 @@ -933,7 +926,7 @@ Other optional parameters are used as follows:\r
125        (save-excursion\r
126         (let ((proc (notmuch-start-notmuch\r
127                      "notmuch-search" buffer #'notmuch-search-process-sentinel\r
128 -                    "search" "--format=json" "--format-version=1"\r
129 +                    "search" "--format=sexp" "--format-version=1"\r
130                      (if oldest-first\r
131                          "--sort=oldest-first"\r
132                        "--sort=newest-first")\r
133 diff --git a/test/emacs b/test/emacs\r
134 index d38ae8c..7d42abf 100755\r
135 --- a/test/emacs\r
136 +++ b/test/emacs\r
137 @@ -856,7 +856,7 @@ test_expect_success "Rendering HTML mail with images" \\r
138  test_begin_subtest "Search handles subprocess error exit codes"\r
139  cat > notmuch_fail <<EOF\r
140  #!/bin/sh\r
141 -echo This is output\r
142 +echo '()'\r
143  exit 1\r
144  EOF\r
145  chmod a+x notmuch_fail\r
146 @@ -871,21 +871,19 @@ test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))\r
147                (test-output))"\r
148  sed -i -e 's/^\[.*\]$/[XXX]/' ERROR\r
149  test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\\r
150 -Error: Unexpected output from notmuch search:\r
151 -This is output\r
152  End of search results.\r
153  ---\r
154  $PWD/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)\r
155  ---\r
156  [XXX]\r
157  $PWD/notmuch_fail exited with status 1\r
158 -command: $PWD/notmuch_fail search --format\=json --format-version\=1 --sort\=newest-first tag\:inbox\r
159 +command: $PWD/notmuch_fail search --format\=sexp --format-version\=1 --sort\=newest-first tag\:inbox\r
160  exit status: 1"\r
161  \r
162  test_begin_subtest "Search handles subprocess warnings"\r
163  cat > notmuch_fail <<EOF\r
164  #!/bin/sh\r
165 -echo This is output\r
166 +echo '()'\r
167  echo This is a warning >&2\r
168  echo This is another warning >&2\r
169  exit 0\r
170 @@ -903,8 +901,6 @@ test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))\r
171                (test-output))"\r
172  sed -i -e 's/^\[.*\]$/[XXX]/' ERROR\r
173  test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\\r
174 -Error: Unexpected output from notmuch search:\r
175 -This is output\r
176  End of search results.\r
177  ---\r
178  This is a warning (see *Notmuch errors* for more details)\r
179 -- \r
180 1.7.10.4\r
181 \r