one more intermittent test failure
[notmuch-archives.git] / d2 / 58106b952d735ceed724c51ace9583631e2671
1 Return-Path: <tomi.ollila@iki.fi>\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 4FFC2431FC0\r
6         for <notmuch@notmuchmail.org>; Wed, 23 Jan 2013 06:13:51 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 q-6M7kcj2iLR for <notmuch@notmuchmail.org>;\r
16         Wed, 23 Jan 2013 06:13:50 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 638D9431FAE\r
19         for <notmuch@notmuchmail.org>; Wed, 23 Jan 2013 06:13:50 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 8D0CD100086;\r
22         Wed, 23 Jan 2013 16:13:39 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH] emacs: hello: use batch count\r
26 In-Reply-To: <1358292247-2059-1-git-send-email-markwalters1009@gmail.com>\r
27 References: <cover.1358273133.git.jani@nikula.org>\r
28         <1358292247-2059-1-git-send-email-markwalters1009@gmail.com>\r
29 User-Agent: Notmuch/0.15+11~ge1e719d (http://notmuchmail.org) Emacs/24.2.1\r
30         (x86_64-unknown-linux-gnu)\r
31 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
32         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
33         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
34 Date: Wed, 23 Jan 2013 16:13:39 +0200\r
35 Message-ID: <m27gn4htrg.fsf@guru.guru-group.fi>\r
36 MIME-Version: 1.0\r
37 Content-Type: text/plain\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Wed, 23 Jan 2013 14:13:51 -0000\r
51 \r
52 On Wed, Jan 16 2013, Mark Walters <markwalters1009@gmail.com> wrote:\r
53 \r
54 > This modifies notmuch hello to use the new count --batch\r
55 > functionality. It should give exactly the same results as before but\r
56 > under many conditions it should be much faster. In particular it is\r
57 > much faster for remote use.\r
58 >\r
59 > The code is a little ugly as it has to do some working out of the\r
60 > query when asking the query and some when dealing with the result.\r
61 > However, the code path is exactly the same in both local and remote\r
62 > use.\r
63 > ---\r
64 \r
65 Well, the code Looks Good To Me (not Bad or Ugly). Pretty straightforward\r
66 conversion.\r
67 \r
68 Can we have newlines in query string^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H\r
69 \r
70 Tomi\r
71 \r
72 >\r
73 > It's a little ugly but seems to work and does give a useful speedup.\r
74 >\r
75 > Best wishes\r
76 >\r
77 > Mark\r
78 >\r
79 >  emacs/notmuch-hello.el |   52 +++++++++++++++++++++++++++++------------------\r
80 >  1 files changed, 32 insertions(+), 20 deletions(-)\r
81 >\r
82 > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
83 > index 6db62a0..2244892 100644\r
84 > --- a/emacs/notmuch-hello.el\r
85 > +++ b/emacs/notmuch-hello.el\r
86 > @@ -381,26 +381,38 @@ The result is the list of elements of the form (NAME QUERY COUNT).\r
87 >  The values :show-empty-searches, :filter and :filter-count from\r
88 >  options will be handled as specified for\r
89 >  `notmuch-hello-insert-searches'."\r
90 > -  (notmuch-remove-if-not\r
91 > -   #'identity\r
92 > -   (mapcar\r
93 > -    (lambda (elem)\r
94 > -      (let* ((name (car elem))\r
95 > -          (query-and-count (if (consp (cdr elem))\r
96 > -                               ;; do we have a different query for the message count?\r
97 > -                               (cons (second elem) (third elem))\r
98 > -                             (cons (cdr elem) (cdr elem))))\r
99 > -          (message-count\r
100 > -           (string-to-number\r
101 > -            (notmuch-saved-search-count\r
102 > -             (notmuch-hello-filtered-query (cdr query-and-count)\r
103 > -                                           (or (plist-get options :filter-count)\r
104 > -                                              (plist-get options :filter)))))))\r
105 > -     (and (or (plist-get options :show-empty-searches) (> message-count 0))\r
106 > -          (list name (notmuch-hello-filtered-query\r
107 > -                      (car query-and-count) (plist-get options :filter))\r
108 > -                message-count))))\r
109 > -    query-alist)))\r
110 > +  (with-temp-buffer\r
111 > +    (dolist (elem query-alist nil)\r
112 > +      (let ((count-query (if (consp (cdr elem))\r
113 > +                          ;; do we have a different query for the message count?\r
114 > +                          (third elem)\r
115 > +                        (cdr elem))))\r
116 > +     (insert\r
117 > +      (notmuch-hello-filtered-query count-query\r
118 > +                                    (or (plist-get options :filter-count)\r
119 > +                                        (plist-get options :filter)))\r
120 > +      "\n")))\r
121 > +\r
122 > +    (call-process-region (point-min) (point-max) notmuch-command\r
123 > +                      t t nil "count" "--batch")\r
124 > +    (goto-char (point-min))\r
125 > +\r
126 > +    (notmuch-remove-if-not\r
127 > +     #'identity\r
128 > +     (mapcar\r
129 > +      (lambda (elem)\r
130 > +     (let ((name (car elem))\r
131 > +           (search-query (if (consp (cdr elem))\r
132 > +                              ;; do we have a different query for the message count?\r
133 > +                              (second elem)\r
134 > +                           (cdr elem)))\r
135 > +           (message-count (prog1 (read (current-buffer))\r
136 > +                             (forward-line 1))))\r
137 > +       (and (or (plist-get options :show-empty-searches) (> message-count 0))\r
138 > +            (list name (notmuch-hello-filtered-query\r
139 > +                        search-query (plist-get options :filter))\r
140 > +                  message-count))))\r
141 > +      query-alist))))\r
142 >  \r
143 >  (defun notmuch-hello-insert-buttons (searches)\r
144 >    "Insert buttons for SEARCHES.\r
145 > -- \r
146 > 1.7.9.1\r
147 >\r
148 > _______________________________________________\r
149 > notmuch mailing list\r
150 > notmuch@notmuchmail.org\r
151 > http://notmuchmail.org/mailman/listinfo/notmuch\r