Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / 06 / 11f7c89ecea6f6d9d3a9393f670e36c00859e8
1 Return-Path: <sojka@os.inf.tu-dresden.de>\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 6E09F431FD0\r
6         for <notmuch@notmuchmail.org>; Fri,  8 Jul 2011 14:23:45 -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 u+BdQlx1CfFP for <notmuch@notmuchmail.org>;\r
16         Fri,  8 Jul 2011 14:23:44 -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 6D1BF431FB6\r
19         for <notmuch@notmuchmail.org>; Fri,  8 Jul 2011 14:23:44 -0700 (PDT)\r
20 Received: from localhost (unknown [192.168.200.4])\r
21         by max.feld.cvut.cz (Postfix) with ESMTP id 316CB19F3346;\r
22         Fri,  8 Jul 2011 23:23:43 +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 hss-pUykJaJg; Fri,  8 Jul 2011 23:23:41 +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 C22CE19F3345;\r
30         Fri,  8 Jul 2011 23:23:41 +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 7973E15C028;\r
34         Fri,  8 Jul 2011 23:23:41 +0200 (CEST)\r
35 Received: from wsh by steelpick.2x.cz with local (Exim 4.76)\r
36         (envelope-from <sojka@os.inf.tu-dresden.de>)\r
37         id 1QfIWS-0000mC-DW; Fri, 08 Jul 2011 23:23:40 +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 v3 1/2] emacs: User-defined sections in notmuch-hello\r
41 In-Reply-To: <87wrfuc5i6.fsf@gilead.invalid>\r
42 References: <1309379221-5617-1-git-send-email-daniel.schoepe@googlemail.com>\r
43         <1309883030-28899-1-git-send-email-daniel.schoepe@googlemail.com>\r
44         <1309883030-28899-2-git-send-email-daniel.schoepe@googlemail.com>\r
45         <87fwmjabii.fsf@steelpick.2x.cz>\r
46         <87oc17r38a.fsf@tredergarh.home.box>\r
47         <871uy25d3y.fsf@steelpick.2x.cz> <87wrfuc5i6.fsf@gilead.invalid>\r
48 User-Agent: Notmuch/0.5-332-gf8bc48d (http://notmuchmail.org) Emacs/23.3.1\r
49         (x86_64-pc-linux-gnu)\r
50 Date: Fri, 08 Jul 2011 23:23:40 +0200\r
51 Message-ID: <87k4bs4gbn.fsf@steelpick.2x.cz>\r
52 MIME-Version: 1.0\r
53 Content-Type: text/plain; charset=us-ascii\r
54 X-BeenThere: notmuch@notmuchmail.org\r
55 X-Mailman-Version: 2.1.13\r
56 Precedence: list\r
57 List-Id: "Use and development of the notmuch mail system."\r
58         <notmuch.notmuchmail.org>\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
62 List-Post: <mailto:notmuch@notmuchmail.org>\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
66 X-List-Received-Date: Fri, 08 Jul 2011 21:23:45 -0000\r
67 \r
68 On Thu, 07 Jul 2011, Daniel Schoepe wrote:\r
69 Non-text part: multipart/signed\r
70 > On Thu, 07 Jul 2011 17:23:13 +0200, Michal Sojka <sojkam1@fel.cvut.cz> wrote:\r
71 > > This wouldn't work for me. My all-tags section covers almost entire\r
72 > > screen and finding non-zero entries there is not very convenient. I find\r
73 > > much more useful to have a section saying: "Hey, you have unread\r
74 > > messages only for these three tags". Moreover, it wouldn't help me to see\r
75 > > non-zero number of unread messages and when I click the button I would\r
76 > > see all the messages, not only the unread ones. It simply seems very\r
77 > > confusing to me.\r
78\r
79 > I agree with you, personally, but I don't think this particular bit\r
80 > (:hide-empty-searches) increases code complexity that much (and all of\r
81 > it is localized to the functions generating the sections, which possibly\r
82 > should be moved to a separate file). I also find it plausible that a\r
83 > user might want behavior like this (as, e.g. an overview, if he doesn't\r
84 > want an all tags section, but still see what tags he has set).\r
85\r
86 > Hence I don't see why we should not provide this option.\r
87 \r
88 OK. I changed my mind. I thought that the approach with 'notmuch\r
89 search-tags QEURY' followed by 'notmuch count tag:XXX and QUERY' for\r
90 returned tags would be faster then 'notmuch search-tags' followed by\r
91 'notmuch count tag:XXX and QUERY' for all tags, but it turned out not to\r
92 be the case.\r
93 \r
94 I played with the customization interface a bit and found the following\r
95 problems:\r
96 \r
97 - It is annoying to insert section titles that includes ": " at the end\r
98   in order to be nicely "rendered". I think this could be appended\r
99   automatically.\r
100 \r
101 - :hide-empty-tags should be renamed in :hide-empty-searches to be\r
102   effective (see the patch below).\r
103 \r
104 - The title of custom tags section was not passed correctly to the\r
105   functions. This is also fixed in the patch below.\r
106 \r
107 -Michal\r
108 \r
109 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
110 index 9c18caa..7e81076 100644\r
111 --- a/emacs/notmuch-hello.el\r
112 +++ b/emacs/notmuch-hello.el\r
113 @@ -113,7 +113,7 @@ Typically \",\" in the US and UK and \".\" in Europe."\r
114            (:make-count (string :tag "Different query to generate counts"))\r
115            (:hide-tags (repeat :tag "Tags that will be hidden" string))\r
116            (:initially-hidden (boolean :tag "Hide this on startup?"))\r
117 -          (:hide-empty-tags (boolean :tag "Hide tags with no matching messages"))\r
118 +          (:hide-empty-searches (boolean :tag "Hide tags with no matching messages"))\r
119            (:hide-if-empty (boolean :tag "Hide if empty")))))\r
120      `(list (const :tag "" notmuch-hello-insert-tags-section)\r
121            (plist :inline t :options ,opts))))\r
122 @@ -129,7 +129,7 @@ Typically \",\" in the US and UK and \".\" in Europe."\r
123          (plist :inline t\r
124                 :options\r
125                 ((:initially-hidden (boolean :tag "Hide this on startup?"))\r
126 -                (:hide-empty-tags\r
127 +                (:hide-empty-searches\r
128                   (boolean :tag "Hide tags with no matching messages"))\r
129                  (:hide-if-empty (boolean :tag "Hide if empty"))))))\r
130  \r
131 @@ -629,7 +629,7 @@ Supports the following entries in OPTIONS as a plist:\r
132         (indent-rigidly start (point) notmuch-hello-indent)\r
133         target-pos))))\r
134  \r
135 -(defun notmuch-hello-insert-tags-section (&optional title &rest options)\r
136 +(defun notmuch-hello-insert-tags-section (&rest options)\r
137    "Insert a section displaying all tags and message counts for each.\r
138  \r
139  TITLE defaults to \"All tags: \".\r
140 @@ -638,7 +638,7 @@ following:\r
141  \r
142  :hide-tags - List of tags that should be excluded."\r
143    (apply 'notmuch-hello-insert-searches\r
144 -        (or title "All tags: ")\r
145 +        (plist-get options :title)\r
146          (notmuch-hello-generate-tag-alist\r
147           (plist-get options :hide-tags)\r
148           (plist-get options :make-query)\r
149 @@ -656,8 +656,8 @@ following:\r
150  \r
151  (defun notmuch-hello-insert-alltags ()\r
152    "Insert a section displaying all tags and associated message counts"\r
153 -  (notmuch-hello-insert-tags-section nil :initially-hidden\r
154 -                                    (not notmuch-show-all-tags-list)))\r
155 +  (notmuch-hello-insert-tags-section :title "All tags: "\r
156 +                                    :initially-hidden (not notmuch-show-all-tags-list)))\r
157  \r
158  (defun notmuch-hello-insert-footer ()\r
159    "Insert the notmuch-hello footer."\r