Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / f4 / b6ad9c6cf98ed98dd1c1d4f3b608339302d25f
1 Return-Path: <m.walters@qmul.ac.uk>\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 88A3A431FC0\r
6         for <notmuch@notmuchmail.org>; Tue, 21 May 2013 07:27:57 -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: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id Ewzg5Nalgrk8 for <notmuch@notmuchmail.org>;\r
17         Tue, 21 May 2013 07:27:51 -0700 (PDT)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 58D8F431FB6\r
22         for <notmuch@notmuchmail.org>; Tue, 21 May 2013 07:27:51 -0700 (PDT)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1UenXZ-0007Rb-IR; Tue, 21 May 2013 15:27:50 +0100\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
28         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
29         (envelope-from <m.walters@qmul.ac.uk>)\r
30         id 1UenXY-00021j-PR; Tue, 21 May 2013 15:27:49 +0100\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH 5/5] emacs: Use streaming S-expr parser for search\r
34 In-Reply-To: <1368851472-5382-6-git-send-email-amdragon@mit.edu>\r
35 References: <1368851472-5382-1-git-send-email-amdragon@mit.edu>\r
36         <1368851472-5382-6-git-send-email-amdragon@mit.edu>\r
37 User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1\r
38         (x86_64-pc-linux-gnu)\r
39 Date: Tue, 21 May 2013 15:27:47 +0100\r
40 Message-ID: <87ip2c2ysc.fsf@qmul.ac.uk>\r
41 MIME-Version: 1.0\r
42 Content-Type: text/plain; charset=us-ascii\r
43 X-Sender-Host-Address: 93.97.24.31\r
44 X-QM-SPAM-Info: Sender has good ham record.  :)\r
45 X-QM-Body-MD5: b0822419b61b875fb8fac3e08803688d (of first 20000 bytes)\r
46 X-SpamAssassin-Score: -0.2\r
47 X-SpamAssassin-SpamBar: /\r
48 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
49         determine if it is\r
50         spam. We require at least 5.0 points to mark a message as spam.\r
51         This message scored -0.2 points.\r
52         Summary of the scoring: \r
53         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
54         provider *      (markwalters1009[at]gmail.com)\r
55         * -0.2 AWL AWL: From: address is in the auto white-list\r
56 X-QM-Scan-Virus: ClamAV says the message is clean\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Tue, 21 May 2013 14:27:57 -0000\r
70 \r
71 \r
72 This patch and patch 3/5 look good to me. Do you intend to take out the\r
73 async json parser immediately after this goes in? If not then I think it\r
74 would be good to tweak the arguments/error handling in the json parser\r
75 so that it matches that in this sexp parser.\r
76 \r
77 Best wishes\r
78 \r
79 Mark\r
80 \r
81 On Sat, 18 May 2013, Austin Clements <amdragon@MIT.EDU> wrote:\r
82 > In addition to being the Right Thing to do, this noticeably improves\r
83 > the time taken to display the first page of search results, since it's\r
84 > roughly an order of magnitude faster than the JSON parser.\r
85 > Interestingly, it does *not* significantly improve the time to\r
86 > completely fill a large search buffer because for large search\r
87 > buffers, the cost of creating author invisibility overlays and\r
88 > inserting text (which slows down with more overlays) dominates.\r
89 > However, the time required to display the first page of results is\r
90 > generally more important to the user experience.\r
91 > ---\r
92 >  emacs/notmuch.el |   13 +++----------\r
93 >  test/emacs       |   10 +++-------\r
94 >  2 files changed, 6 insertions(+), 17 deletions(-)\r
95 >\r
96 > diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
97 > index b8d9c44..5a8c957 100644\r
98 > --- a/emacs/notmuch.el\r
99 > +++ b/emacs/notmuch.el\r
100 > @@ -58,6 +58,7 @@\r
101 >  (require 'notmuch-hello)\r
102 >  (require 'notmuch-maildir-fcc)\r
103 >  (require 'notmuch-message)\r
104 > +(require 'notmuch-parser)\r
105 >  \r
106 >  (defcustom notmuch-search-result-format\r
107 >    `(("date" . "%12s ")\r
108 > @@ -809,13 +810,6 @@ non-authors is found, assume that all of the authors match."\r
109 >       (setq notmuch-search-target-thread "found")\r
110 >       (goto-char beg)))))\r
111 >  \r
112 > -(defun notmuch-search-show-error (string &rest objects)\r
113 > -  (save-excursion\r
114 > -    (goto-char (point-max))\r
115 > -    (insert "Error: Unexpected output from notmuch search:\n")\r
116 > -    (insert (apply #'format string objects))\r
117 > -    (insert "\n")))\r
118 > -\r
119 >  (defun notmuch-search-process-filter (proc string)\r
120 >    "Process and filter the output of \"notmuch search\""\r
121 >    (let ((results-buf (process-buffer proc))\r
122 > @@ -829,8 +823,7 @@ non-authors is found, assume that all of the authors match."\r
123 >       (save-excursion\r
124 >         (goto-char (point-max))\r
125 >         (insert string))\r
126 > -     (notmuch-json-parse-partial-list 'notmuch-search-show-result\r
127 > -                                      'notmuch-search-show-error\r
128 > +     (notmuch-sexp-parse-partial-list 'notmuch-search-show-result\r
129 >                                        results-buf)))))\r
130 >  \r
131 >  (defun notmuch-search-tag-all (&optional tag-changes)\r
132 > @@ -933,7 +926,7 @@ Other optional parameters are used as follows:\r
133 >        (save-excursion\r
134 >       (let ((proc (notmuch-start-notmuch\r
135 >                    "notmuch-search" buffer #'notmuch-search-process-sentinel\r
136 > -                  "search" "--format=json" "--format-version=1"\r
137 > +                  "search" "--format=sexp" "--format-version=1"\r
138 >                    (if oldest-first\r
139 >                        "--sort=oldest-first"\r
140 >                      "--sort=newest-first")\r
141 > diff --git a/test/emacs b/test/emacs\r
142 > index d38ae8c..7d42abf 100755\r
143 > --- a/test/emacs\r
144 > +++ b/test/emacs\r
145 > @@ -856,7 +856,7 @@ test_expect_success "Rendering HTML mail with images" \\r
146 >  test_begin_subtest "Search handles subprocess error exit codes"\r
147 >  cat > notmuch_fail <<EOF\r
148 >  #!/bin/sh\r
149 > -echo This is output\r
150 > +echo '()'\r
151 >  exit 1\r
152 >  EOF\r
153 >  chmod a+x notmuch_fail\r
154 > @@ -871,21 +871,19 @@ test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))\r
155 >              (test-output))"\r
156 >  sed -i -e 's/^\[.*\]$/[XXX]/' ERROR\r
157 >  test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\\r
158 > -Error: Unexpected output from notmuch search:\r
159 > -This is output\r
160 >  End of search results.\r
161 >  ---\r
162 >  $PWD/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)\r
163 >  ---\r
164 >  [XXX]\r
165 >  $PWD/notmuch_fail exited with status 1\r
166 > -command: $PWD/notmuch_fail search --format\=json --format-version\=1 --sort\=newest-first tag\:inbox\r
167 > +command: $PWD/notmuch_fail search --format\=sexp --format-version\=1 --sort\=newest-first tag\:inbox\r
168 >  exit status: 1"\r
169 >  \r
170 >  test_begin_subtest "Search handles subprocess warnings"\r
171 >  cat > notmuch_fail <<EOF\r
172 >  #!/bin/sh\r
173 > -echo This is output\r
174 > +echo '()'\r
175 >  echo This is a warning >&2\r
176 >  echo This is another warning >&2\r
177 >  exit 0\r
178 > @@ -903,8 +901,6 @@ test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))\r
179 >              (test-output))"\r
180 >  sed -i -e 's/^\[.*\]$/[XXX]/' ERROR\r
181 >  test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\\r
182 > -Error: Unexpected output from notmuch search:\r
183 > -This is output\r
184 >  End of search results.\r
185 >  ---\r
186 >  This is a warning (see *Notmuch errors* for more details)\r
187 > -- \r
188 > 1.7.10.4\r