1 Return-Path: <markwalters1009@gmail.com>
\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 4E2BF431FBF
\r
6 for <notmuch@notmuchmail.org>; Sun, 11 May 2014 01:34:57 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id g6vWVQpyH0TF for <notmuch@notmuchmail.org>;
\r
18 Sun, 11 May 2014 01:34:51 -0700 (PDT)
\r
19 Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com
\r
20 [74.125.82.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
21 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
22 99F51431FC0 for <notmuch@notmuchmail.org>; Sun, 11 May 2014 01:34:51 -0700
\r
24 Received: by mail-wg0-f47.google.com with SMTP id x12so5511982wgg.6
\r
25 for <notmuch@notmuchmail.org>; Sun, 11 May 2014 01:34:49 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:in-reply-to:references;
\r
28 bh=N1+1WnnbCmlsWbuJns99+T3NGsJZvexJr6Fu1BEjHW8=;
\r
29 b=OZ2On+P3Pnq7wDfmR6yQB1+wGpy+va4AJYo4YP+Q/cC37AVfJKtOUJ2/n+GNUxKwTJ
\r
30 11hxLfHRjZ5AkAe9vRjMgtPChZON6Y6hRkHkq62vDTUUDkOdkNH/qlWOXhRCM045BOOO
\r
31 fuyk2IgsZQIk4MXXgQFxA/CSgTgNgJjOwZn4nj3i9gOtkV/pQ1Ds7DAEkrzKxzHT4z9s
\r
32 9tf0uE3crxAOJ9tHChOZLhKN9vjg1sdKA44PDnGRu/yEXMfjqIMneRENq0c/Kgt8khYW
\r
33 dKI8y3l6jhIVtztWN1c3IT266ddAv83ySmacgKS2zN/pFqLNJukQWzABSqBb08Ce5rhf
\r
35 X-Received: by 10.194.206.2 with SMTP id lk2mr15971349wjc.33.1399797289354;
\r
36 Sun, 11 May 2014 01:34:49 -0700 (PDT)
\r
37 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])
\r
38 by mx.google.com with ESMTPSA id gz1sm9091621wib.14.2014.05.11.01.34.48
\r
39 for <multiple recipients>
\r
40 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
41 Sun, 11 May 2014 01:34:48 -0700 (PDT)
\r
42 From: Mark Walters <markwalters1009@gmail.com>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH 1/7] emacs: hello: separate out the saved-search display
\r
46 Date: Sun, 11 May 2014 09:34:36 +0100
\r
47 Message-Id: <1399797282-20389-2-git-send-email-markwalters1009@gmail.com>
\r
48 X-Mailer: git-send-email 1.7.10.4
\r
49 In-Reply-To: <1399797282-20389-1-git-send-email-markwalters1009@gmail.com>
\r
50 References: <1399797282-20389-1-git-send-email-markwalters1009@gmail.com>
\r
51 X-BeenThere: notmuch@notmuchmail.org
\r
52 X-Mailman-Version: 2.1.13
\r
54 List-Id: "Use and development of the notmuch mail system."
\r
55 <notmuch.notmuchmail.org>
\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
57 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
59 List-Post: <mailto:notmuch@notmuchmail.org>
\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
63 X-List-Received-Date: Sun, 11 May 2014 08:34:57 -0000
\r
65 Separate the code that prints a saved-search and count into its own
\r
68 emacs/notmuch-hello.el | 30 +++++++++++++++++++-----------
\r
69 1 file changed, 19 insertions(+), 11 deletions(-)
\r
71 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
72 index 3de5238..0a7004c 100644
\r
73 --- a/emacs/notmuch-hello.el
\r
74 +++ b/emacs/notmuch-hello.el
\r
75 @@ -475,6 +475,22 @@ (defun notmuch-hello-filtered-query (query filter)
\r
76 (concat "(" query ") and (" filter ")"))
\r
79 +(defun notmuch-hello-batch-message-count (elem-plist options)
\r
80 + "Update the message count for a saved search.
\r
82 +This takes the next line in the current buffer (the output from a
\r
83 +call to notmuch count --batch) as the message count and sets
\r
84 +the :count property in ELEM-PLIST to it."
\r
85 + (let* ((count (prog1 (read (current-buffer))
\r
86 + (forward-line 1)))
\r
87 + (search-query (plist-get elem-plist :query))
\r
88 + (filtered-query (notmuch-hello-filtered-query
\r
89 + search-query (plist-get options :filter))))
\r
90 + (when (and filtered-query (or (plist-get options :show-empty-searches)
\r
92 + (setq elem-plist (plist-put elem-plist :query filtered-query))
\r
93 + (plist-put elem-plist :count (notmuch-hello-nice-number count)))))
\r
95 (defun notmuch-hello-query-counts (query-list &rest options)
\r
96 "Compute list of counts of matched messages from QUERY-LIST.
\r
98 @@ -514,15 +530,8 @@ (defun notmuch-hello-query-counts (query-list &rest options)
\r
102 - (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem))
\r
103 - (search-query (plist-get elem-plist :query))
\r
104 - (filtered-query (notmuch-hello-filtered-query
\r
105 - search-query (plist-get options :filter)))
\r
106 - (message-count (prog1 (read (current-buffer))
\r
107 - (forward-line 1))))
\r
108 - (when (and filtered-query (or (plist-get options :show-empty-searches) (> message-count 0)))
\r
109 - (setq elem-plist (plist-put elem-plist :query filtered-query))
\r
110 - (plist-put elem-plist :count message-count))))
\r
111 + (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem)))
\r
112 + (notmuch-hello-batch-message-count elem-plist options)))
\r
115 (defun notmuch-hello-insert-buttons (searches)
\r
116 @@ -558,8 +567,7 @@ (defun notmuch-hello-insert-buttons (searches)
\r
118 (otherwise notmuch-search-oldest-first)))
\r
119 (msg-count (plist-get elem :count)))
\r
120 - (widget-insert (format "%8s "
\r
121 - (notmuch-hello-nice-number msg-count)))
\r
122 + (widget-insert (format "%8s " msg-count))
\r
123 (widget-create 'push-button
\r
124 :notify #'notmuch-hello-widget-search
\r
125 :notmuch-search-terms query
\r