notmuch search and tags
[notmuch-archives.git] / 35 / da8287e4b1bfac340856646d3a5520d2fca041
1 Return-Path: <sojkam1@fel.cvut.cz>\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 18A5A431FD0\r
6         for <notmuch@notmuchmail.org>; Fri,  8 Jul 2011 16:00:09 -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: 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 y4aD6WZzGN2S for <notmuch@notmuchmail.org>;\r
16         Fri,  8 Jul 2011 16:00:07 -0700 (PDT)\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
18         by olra.theworths.org (Postfix) with ESMTP id C2BC5431FB6\r
19         for <notmuch@notmuchmail.org>; Fri,  8 Jul 2011 16:00:06 -0700 (PDT)\r
20 Received: from localhost (unknown [192.168.200.4])\r
21         by max.feld.cvut.cz (Postfix) with ESMTP id E50C519F3348;\r
22         Sat,  9 Jul 2011 01:00:05 +0200 (CEST)\r
23 X-Virus-Scanned: IMAP AMAVIS\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])\r
25         by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
26         port 10044)\r
27         with ESMTP id W0l+-Feoi3-d; Sat,  9 Jul 2011 01:00:04 +0200 (CEST)\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
29         by max.feld.cvut.cz (Postfix) with ESMTP id 45F2F19F32F2;\r
30         Sat,  9 Jul 2011 01:00:04 +0200 (CEST)\r
31 Received: from steelpick.2x.cz (cable-86-56-4-108.cust.telecolumbus.net\r
32         [86.56.4.108]) (Authenticated sender: sojkam1)\r
33         by imap.feld.cvut.cz (Postfix) with ESMTPSA id 3750CFA003;\r
34         Sat,  9 Jul 2011 01:00:04 +0200 (CEST)\r
35 Received: from wsh by steelpick.2x.cz with local (Exim 4.76)\r
36         (envelope-from <sojkam1@fel.cvut.cz>)\r
37         id 1QfK1j-0002oC-Gw; Sat, 09 Jul 2011 01:00:03 +0200\r
38 From: Michal Sojka <sojkam1@fel.cvut.cz>\r
39 To: Daniel Schoepe <daniel.schoepe@googlemail.com>, notmuch@notmuchmail.org\r
40 Subject: Re: [PATCH v4 1/2] emacs: User-defined sections in notmuch-hello\r
41 In-Reply-To: <1310079227-19120-2-git-send-email-daniel.schoepe@googlemail.com>\r
42 References:\r
43  <id:"1309379221-5617-1-git-send-email-daniel.schoepe@googlemail.com">\r
44         <1310079227-19120-1-git-send-email-daniel.schoepe@googlemail.com>\r
45         <1310079227-19120-2-git-send-email-daniel.schoepe@googlemail.com>\r
46 User-Agent: Notmuch/0.5-332-gf8bc48d (http://notmuchmail.org) Emacs/23.3.1\r
47         (x86_64-pc-linux-gnu)\r
48 Date: Sat, 09 Jul 2011 01:00:03 +0200\r
49 Message-ID: <87box48jkc.fsf@steelpick.2x.cz>\r
50 MIME-Version: 1.0\r
51 Content-Type: text/plain; charset=us-ascii\r
52 X-BeenThere: notmuch@notmuchmail.org\r
53 X-Mailman-Version: 2.1.13\r
54 Precedence: list\r
55 List-Id: "Use and development of the notmuch mail system."\r
56         <notmuch.notmuchmail.org>\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
60 List-Post: <mailto:notmuch@notmuchmail.org>\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
64 X-List-Received-Date: Fri, 08 Jul 2011 23:00:09 -0000\r
65 \r
66 On Fri, 08 Jul 2011, Daniel Schoepe wrote:\r
67 > This has been done in v4 of the patch, for which I screwed up the\r
68 > In-Reply-To header and hence is listed as a separate thread:\r
69\r
70 > id:"1310079227-19120-1-git-send-email-daniel.schoepe@googlemail.com"\r
71 \r
72 Oh, you always send new versions faster than I can investigate the older\r
73 ones :-)\r
74 \r
75 > > - The title of custom tags section was not passed correctly to the\r
76 > >   functions. This is also fixed in the patch below.\r
77\r
78 > I changed title to a mandatory argument for consistency with\r
79 > notmuch-insert-searches and because a title-less section wouldn't make\r
80 > much sense anyway.\r
81 \r
82 Yes, this is definitely a good idea. My last comment to the patch is\r
83 that I do not like the use of plists in customization interface. It is\r
84 especially weird in the case of boolean options like hide-if-empty,\r
85 because they actually have three states: disabled, off and on. And this\r
86 make not a lot of sense.\r
87 \r
88 I think that the customization interface is much better arranged when it\r
89 is modified like in the patch below (it is against v3).\r
90 \r
91 -Michal\r
92 \r
93 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
94 index d3b146e..3e883ff 100644\r
95 --- a/emacs/notmuch-hello.el\r
96 +++ b/emacs/notmuch-hello.el\r
97 @@ -106,17 +106,14 @@ Typically \",\" in the US and UK and \".\" in Europe."\r
98  (define-widget 'notmuch-hello-tags-section 'lazy\r
99    "Customize-type for notmuch-hello tag-list sections."\r
100    :tag "Customized tag-list"\r
101 -  :type\r
102 -  (let ((opts\r
103 -        '((:title (string :tag "Title for this section"))\r
104 -          (:make-query (string :tag "Filter for each tag"))\r
105 -          (:make-count (string :tag "Different query to generate counts"))\r
106 -          (:hide-tags (repeat :tag "Tags that will be hidden" string))\r
107 -          (:initially-hidden (boolean :tag "Hide this on startup?"))\r
108 -          (:hide-empty-tags (boolean :tag "Hide tags with no matching messages"))\r
109 -          (:hide-if-empty (boolean :tag "Hide if empty")))))\r
110 -    `(list (const :tag "" notmuch-hello-insert-tags-section)\r
111 -          (plist :inline t :options ,opts))))\r
112 +  :type '(list (const :tag "" notmuch-hello-insert-tags-section)\r
113 +              (string :tag "Title for this section")\r
114 +              (string :tag "Filter for each tag")\r
115 +              (string :tag "Different filter to generate counts")\r
116 +              (repeat :tag "Tags that will be hidden" string)\r
117 +              (boolean :tag "Hide this on startup?")\r
118 +              (boolean :tag "Hide tags with no matching messages")\r
119 +              (boolean :tag "Hide if empty")))\r
120  \r
121  (define-widget 'notmuch-hello-query-section 'lazy\r
122    "Customize-type for custom saved-search-like sections"\r
123 @@ -629,7 +626,8 @@ Supports the following entries in OPTIONS as a plist:\r
124         (indent-rigidly start (point) notmuch-hello-indent)\r
125         target-pos))))\r
126  \r
127 -(defun notmuch-hello-insert-tags-section (&rest options)\r
128 +(defun notmuch-hello-insert-tags-section (title &optional filter filter-count hide-tags initially-hidden\r
129 +                                               hide-empty-searches hide-if-empty)\r
130    "Insert a section displaying all tags and message counts for each.\r
131  \r
132  TITLE defaults to \"All tags: \".\r
133 @@ -637,13 +635,13 @@ Allowed options are those accepted by `notmuch-hello-insert-searches' and the\r
134  following:\r
135  \r
136  :hide-tags - List of tags that should be excluded."\r
137 -  (apply 'notmuch-hello-insert-searches\r
138 -        (plist-get options :title)\r
139 -        (notmuch-hello-generate-tag-alist\r
140 -         (plist-get options :hide-tags)\r
141 -         (plist-get options :make-query)\r
142 -         (plist-get options :make-count))\r
143 -        options))\r
144 +  (notmuch-hello-insert-searches title\r
145 +                                (notmuch-hello-generate-tag-alist hide-tags filter\r
146 +                                                                  (if (string= "" filter-count)\r
147 +                                                                      nil filter-count))\r
148 +                                :initially-hidden initially-hidden\r
149 +                                :hide-empty-searches hide-empty-searches\r
150 +                                :hide-if-empty hide-if-empty))\r
151  \r
152  (defun notmuch-hello-insert-inbox ()\r
153    "Show an entry for each saved search and inboxed messages for each tag"\r