Re: [PATCH] lib: reword comment about XFOLDER: prefix
[notmuch-archives.git] / 5f / 4ab28a00f37b2a1e66f7ff32c44d41057781a4
1 Return-Path: <jani@nikula.org>\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 409BC431FC2\r
6         for <notmuch@notmuchmail.org>; Sat,  9 Mar 2013 07:13:07 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: -0.7\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
13         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 DdHd3rKlyCar for <notmuch@notmuchmail.org>;\r
17         Sat,  9 Mar 2013 07:13:05 -0800 (PST)\r
18 Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com\r
19         [209.85.217.178]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 2AB41431FAE\r
22         for <notmuch@notmuchmail.org>; Sat,  9 Mar 2013 07:12:57 -0800 (PST)\r
23 Received: by mail-lb0-f178.google.com with SMTP id n1so2077124lba.37\r
24         for <notmuch@notmuchmail.org>; Sat, 09 Mar 2013 07:12:55 -0800 (PST)\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=google.com; s=20120113;\r
27         h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
28         :references:in-reply-to:references:x-gm-message-state;\r
29         bh=2xAOn7Li7EL6Z30EI/5y7AAh4fM0Ecb7KaJmOTAgp20=;\r
30         b=KeflAwsyi9rnx+H7LGa5pHKeBbdsL8obcaDmq1zs8PmPNQUWC0OZ9+QapIy/z3WF0d\r
31         UBBLrVEQbSP7wOTK90TykqV91zzpvbg9eWtVO1+p3odfTh1z9b8Lr3MHesGwHfhcxQqF\r
32         V9xeW1VDAZ/8XDtTkrIdDiasTRJ/uYJhE72NAYWhBmnlEF3oh04wXJ+0vN5D1vuLZE1B\r
33         PAV5oJC5Mn5PDCET5MBpwZEPw9tao4n7PIE2GFQb7Tcnavfda3gxCYFfoma1j5sjmMQn\r
34         BifZn08AGtLDRI9kEHcRL0RbNo78Dg7baybD2+OCbOYBJWYYTFq3hf+zoSjwRSIuDWuY\r
35         Uc1A==\r
36 X-Received: by 10.152.110.6 with SMTP id hw6mr5221950lab.43.1362841975719;\r
37         Sat, 09 Mar 2013 07:12:55 -0800 (PST)\r
38 Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi.\r
39         [80.223.81.27])\r
40         by mx.google.com with ESMTPS id xw14sm4276065lab.6.2013.03.09.07.12.53\r
41         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
42         Sat, 09 Mar 2013 07:12:55 -0800 (PST)\r
43 From: Jani Nikula <jani@nikula.org>\r
44 To: notmuch@notmuchmail.org\r
45 Subject: [PATCH v2 6/6] emacs: hello: use batch count\r
46 Date: Sat,  9 Mar 2013 17:12:26 +0200\r
47 Message-Id:\r
48  <09827d9c7e237b45955bb1c96d802ebd7887f868.1362841844.git.jani@nikula.org>\r
49 X-Mailer: git-send-email 1.7.10.4\r
50 In-Reply-To: <cover.1362841844.git.jani@nikula.org>\r
51 References: <cover.1362841844.git.jani@nikula.org>\r
52 In-Reply-To: <cover.1362841844.git.jani@nikula.org>\r
53 References: <cover.1362841844.git.jani@nikula.org>\r
54 X-Gm-Message-State:\r
55  ALoCoQlemJFMDyEwRJvGeh3fu3ItA3fve8PRLOZyZrEk1vh532zytIdKBsrx/g6P/IZxjlUeO3MH\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Sat, 09 Mar 2013 15:13:07 -0000\r
69 \r
70 From: Mark Walters <markwalters1009@gmail.com>\r
71 \r
72 This modifies notmuch hello to use the new count --batch\r
73 functionality. It should give exactly the same results as before but\r
74 under many conditions it should be much faster. In particular it is\r
75 much faster for remote use.\r
76 \r
77 The code is a little ugly as it has to do some working out of the\r
78 query when asking the query and some when dealing with the result.\r
79 However, the code path is exactly the same in both local and remote\r
80 use.\r
81 ---\r
82  emacs/notmuch-hello.el |   52 +++++++++++++++++++++++++++++-------------------\r
83  1 file changed, 32 insertions(+), 20 deletions(-)\r
84 \r
85 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
86 index 00b78e1..cda79f1 100644\r
87 --- a/emacs/notmuch-hello.el\r
88 +++ b/emacs/notmuch-hello.el\r
89 @@ -381,26 +381,38 @@ The result is the list of elements of the form (NAME QUERY COUNT).\r
90  The values :show-empty-searches, :filter and :filter-count from\r
91  options will be handled as specified for\r
92  `notmuch-hello-insert-searches'."\r
93 -  (notmuch-remove-if-not\r
94 -   #'identity\r
95 -   (mapcar\r
96 -    (lambda (elem)\r
97 -      (let* ((name (car elem))\r
98 -            (query-and-count (if (consp (cdr elem))\r
99 -                                 ;; do we have a different query for the message count?\r
100 -                                 (cons (second elem) (third elem))\r
101 -                               (cons (cdr elem) (cdr elem))))\r
102 -            (message-count\r
103 -             (string-to-number\r
104 -              (notmuch-saved-search-count\r
105 -               (notmuch-hello-filtered-query (cdr query-and-count)\r
106 -                                             (or (plist-get options :filter-count)\r
107 -                                                (plist-get options :filter)))))))\r
108 -       (and (or (plist-get options :show-empty-searches) (> message-count 0))\r
109 -            (list name (notmuch-hello-filtered-query\r
110 -                        (car query-and-count) (plist-get options :filter))\r
111 -                  message-count))))\r
112 -    query-alist)))\r
113 +  (with-temp-buffer\r
114 +    (dolist (elem query-alist nil)\r
115 +      (let ((count-query (if (consp (cdr elem))\r
116 +                            ;; do we have a different query for the message count?\r
117 +                            (third elem)\r
118 +                          (cdr elem))))\r
119 +       (insert\r
120 +        (notmuch-hello-filtered-query count-query\r
121 +                                      (or (plist-get options :filter-count)\r
122 +                                          (plist-get options :filter)))\r
123 +        "\n")))\r
124 +\r
125 +    (call-process-region (point-min) (point-max) notmuch-command\r
126 +                        t t nil "count" "--batch")\r
127 +    (goto-char (point-min))\r
128 +\r
129 +    (notmuch-remove-if-not\r
130 +     #'identity\r
131 +     (mapcar\r
132 +      (lambda (elem)\r
133 +       (let ((name (car elem))\r
134 +             (search-query (if (consp (cdr elem))\r
135 +                                ;; do we have a different query for the message count?\r
136 +                                (second elem)\r
137 +                             (cdr elem)))\r
138 +             (message-count (prog1 (read (current-buffer))\r
139 +                               (forward-line 1))))\r
140 +         (and (or (plist-get options :show-empty-searches) (> message-count 0))\r
141 +              (list name (notmuch-hello-filtered-query\r
142 +                          search-query (plist-get options :filter))\r
143 +                    message-count))))\r
144 +      query-alist))))\r
145  \r
146  (defun notmuch-hello-insert-buttons (searches)\r
147    "Insert buttons for SEARCHES.\r
148 -- \r
149 1.7.10.4\r
150 \r