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 5BC83431FDE
\r
6 for <notmuch@notmuchmail.org>; Sat, 5 Apr 2014 14:25:02 -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 He7YdcA5VSdB for <notmuch@notmuchmail.org>;
\r
18 Sat, 5 Apr 2014 14:24:57 -0700 (PDT)
\r
19 Received: from mail-we0-f173.google.com (mail-we0-f173.google.com
\r
20 [74.125.82.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 9B7FF431FAF
\r
23 for <notmuch@notmuchmail.org>; Sat, 5 Apr 2014 14:24:52 -0700 (PDT)
\r
24 Received: by mail-we0-f173.google.com with SMTP id w61so4950022wes.4
\r
25 for <notmuch@notmuchmail.org>; Sat, 05 Apr 2014 14:24:51 -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=UWuT3ixcgYokK94vpuueVIlsaznA24sP2RjU8bwoyYE=;
\r
29 b=iEEawt6oVNLpgzgZHvN4nqJUPhdu838taKdwBbFv/rzzDiGShlVLA1T5ekYfeC9AIQ
\r
30 Xokp0k7DCAlcfCvnnsS8wijim031e03bLaRRZyFouF3Dc/b7821CO6m/nbj5wy7LFni5
\r
31 x7WB5S4Hi6oKVKZYfL6U0kSfzldnvg57GdhE2vXyBNubtrPY+o682y0Gc/CCvzMTKUyn
\r
32 JFg0B3RgXuaUM6deFDNx2OYVf8NFZOh7cig3nq2/YyJH/H5Np1QXD+kowjgV/VAKGOhC
\r
33 HCFL3/qObNMvrvpcxJVz1BwU07Fw5NGl/ThOrwvzmrDKCTIccGtpWdtlsczowtTq8/Fn
\r
35 X-Received: by 10.194.24.194 with SMTP id w2mr30614493wjf.25.1396733090103;
\r
36 Sat, 05 Apr 2014 14:24:50 -0700 (PDT)
\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])
\r
38 by mx.google.com with ESMTPSA id q2sm13065203wix.5.2014.04.05.14.24.49
\r
39 for <multiple recipients>
\r
40 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
41 Sat, 05 Apr 2014 14:24:49 -0700 (PDT)
\r
42 From: Mark Walters <markwalters1009@gmail.com>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH 4/5] emacs: hello: switch notmuch-hello-insert-buttons to
\r
46 Date: Sat, 5 Apr 2014 22:24:24 +0100
\r
47 Message-Id: <1396733065-32602-5-git-send-email-markwalters1009@gmail.com>
\r
48 X-Mailer: git-send-email 1.7.10.4
\r
49 In-Reply-To: <1396733065-32602-1-git-send-email-markwalters1009@gmail.com>
\r
50 References: <1396733065-32602-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: Sat, 05 Apr 2014 21:25:02 -0000
\r
65 Switching notmuch-hello-insert-buttons to plists means we can easily
\r
66 pass extra options through to the buttons.
\r
68 emacs/notmuch-hello.el | 33 +++++++++++++++++++--------------
\r
69 1 file changed, 19 insertions(+), 14 deletions(-)
\r
71 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
\r
72 index c729af2..aa40e6f 100644
\r
73 --- a/emacs/notmuch-hello.el
\r
74 +++ b/emacs/notmuch-hello.el
\r
75 @@ -425,7 +425,9 @@ (defun notmuch-hello-query-counts (query-list &rest options)
\r
76 these is a plist but other options are available for backwards
\r
77 compatibility: see notmuch-saved-search-get for details.
\r
79 -The result is the list of elements of the form (NAME QUERY COUNT).
\r
80 +The result is a list of plists each of which includes the
\r
81 +pairs :name NAME, :query QUERY and :count COUNT, together with
\r
82 +any pairs in the original saved-search.
\r
84 The values :show-empty-searches, :filter and :filter-count from
\r
85 options will be handled as specified for
\r
86 @@ -455,23 +457,26 @@ (defun notmuch-hello-query-counts (query-list &rest options)
\r
90 - (let ((name (notmuch-saved-search-get elem :name))
\r
91 - (search-query (notmuch-saved-search-get elem :query))
\r
92 - (message-count (prog1 (read (current-buffer))
\r
93 + (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem))
\r
94 + (search-query (plist-get elem-plist :query))
\r
95 + (filtered-query (notmuch-hello-filtered-query
\r
96 + search-query (plist-get options :filter)))
\r
97 + (message-count (prog1 (read (current-buffer))
\r
99 (and (or (plist-get options :show-empty-searches) (> message-count 0))
\r
100 - (list name (notmuch-hello-filtered-query
\r
101 - search-query (plist-get options :filter))
\r
102 - message-count))))
\r
103 + (setq elem-plist (plist-put elem-plist :query filtered-query))
\r
104 + (plist-put elem-plist :count message-count))))
\r
107 (defun notmuch-hello-insert-buttons (searches)
\r
108 "Insert buttons for SEARCHES.
\r
110 -SEARCHES must be a list containing lists of the form (NAME QUERY COUNT), where
\r
111 -QUERY is the query to start when the button for the corresponding entry is
\r
112 -activated. COUNT should be the number of messages matching the query.
\r
113 -Such a list can be computed with `notmuch-hello-query-counts'."
\r
114 +SEARCHES must be a list of plists each of which should contain at
\r
115 +least pairs for :name NAME :query QUERY and :count COUNT, where
\r
116 +QUERY is the query to start when the button for the corresponding
\r
117 +entry is activated, and COUNT should be the number of messages
\r
118 +matching the query. Such a plist can be computed with
\r
119 +`notmuch-hello-query-counts'."
\r
120 (let* ((widest (notmuch-hello-longest-label searches))
\r
121 (tags-and-width (notmuch-hello-tags-per-line widest))
\r
122 (tags-per-line (car tags-and-width))
\r
123 @@ -489,9 +494,9 @@ (defun notmuch-hello-insert-buttons (searches)
\r
125 (if (> column-indent 0)
\r
126 (widget-insert (make-string column-indent ? )))
\r
127 - (let* ((name (first elem))
\r
128 - (query (second elem))
\r
129 - (msg-count (third elem)))
\r
130 + (let* ((name (plist-get elem :name))
\r
131 + (query (plist-get elem :query))
\r
132 + (msg-count (plist-get elem :count)))
\r
133 (widget-insert (format "%8s "
\r
134 (notmuch-hello-nice-number msg-count)))
\r
135 (widget-create 'push-button
\r