database error
[notmuch-archives.git] / b4 / 574552ff601618efd2ec7fe48368412af2e762
1 Return-Path: <cworth@cworth.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 AC360431FC0;\r
6         Wed,  2 Dec 2009 13:36:15 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id ApUQpouN4CKZ; Wed,  2 Dec 2009 13:36:14 -0800 (PST)\r
11 Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
12         by olra.theworths.org (Postfix) with ESMTP id 4052B431FAE;\r
13         Wed,  2 Dec 2009 13:36:14 -0800 (PST)\r
14 Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
15         id F11D82542A9; Wed,  2 Dec 2009 13:36:13 -0800 (PST)\r
16 From: Carl Worth <cworth@cworth.org>\r
17 To: Jan Janak <jan@ryngle.com>, notmuch@notmuchmail.org\r
18 In-Reply-To: <1259100630-13673-1-git-send-email-jan@ryngle.com>\r
19 References: <1259100630-13673-1-git-send-email-jan@ryngle.com>\r
20 Date: Wed, 02 Dec 2009 13:36:13 -0800\r
21 Message-ID: <87ws1583ea.fsf@yoom.home.cworth.org>\r
22 MIME-Version: 1.0\r
23 Content-Type: multipart/signed; boundary="=-=-=";\r
24         micalg=pgp-sha1; protocol="application/pgp-signature"\r
25 Subject: Re: [notmuch] [PATCH 0/4] Make tags applied by 'notmuch new'\r
26  configurable.\r
27 X-BeenThere: notmuch@notmuchmail.org\r
28 X-Mailman-Version: 2.1.12\r
29 Precedence: list\r
30 List-Id: "Use and development of the notmuch mail system."\r
31         <notmuch.notmuchmail.org>\r
32 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
33         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
34 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
35 List-Post: <mailto:notmuch@notmuchmail.org>\r
36 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
37 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
38         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
39 X-List-Received-Date: Wed, 02 Dec 2009 21:36:15 -0000\r
40 \r
41 --=-=-=\r
42 Content-Transfer-Encoding: quoted-printable\r
43 \r
44 On Tue, 24 Nov 2009 23:10:26 +0100, Jan Janak <jan@ryngle.com> wrote:\r
45 > I would like to propose that we make the list of tags applied by 'notmuch=\r
46  new'\r
47 > configurable. Right now notmuch applies two tags to all new messages adde=\r
48 d to\r
49 > the database, 'inbox' and 'unread'. The two tags are added by the C code =\r
50 in\r
51 > notmuch-new.c and they cannot be changed without editing the source file =\r
52 and\r
53 > recompiling notmuch.\r
54 \r
55 Hi Jan,\r
56 \r
57 Sorry to leave this thread sitting without review for so long. My travel\r
58 schedule, combined with a big US holiday last week combined to create a\r
59 fair amount of backlog.\r
60 \r
61 > This change was motivated by my desire to remove both tags from newly add=\r
62 ed\r
63 > messages. My rules for adding these two tags are more complex and I do it=\r
64  in\r
65 > a script run after 'notmuch new'. Instead of 'inbox' and 'unread', I conf=\r
66 igure\r
67 > 'notmuch new' to add a new tag called 'new' (and only that one). This tag\r
68 > marks newly added messages that haven't been properly tagged yet by my=20\r
69 > auto-tagging scripts. The last script I run after 'notmuch new' removes t=\r
70 hat\r
71 > tag. My auto-tagging scripts process only messages with the tag 'new'.\r
72 \r
73 As a side-note, I would recommend against making your auto-tagging\r
74 scripts process only new messages. You can get a much more reliable\r
75 setup by having your auto-tagging scripts apply to the global\r
76 database. And this is not inefficient at all if you simply ensure that\r
77 you only match messages which need the tag added.\r
78 \r
79 For example, in your current setup you presumably have something like:\r
80 \r
81         notmuch tag +foo <foo-specific-search-terms> and tag:new\r
82 \r
83 If you change that to:\r
84 \r
85         notmuch tag +foo <foo-specific-search-terms> and not tag:foo\r
86 \r
87 then you have the advantage of being able to change the search terms you\r
88 are using for the "foo" tag and know that this tag will be applied\r
89 globally, (and not only to messages incorporated since the rule\r
90 change). Also, you should find that this performs just fine.\r
91 \r
92 You could also have a second specification that would support removing\r
93 the "foo" tag if the terms ever changed to become more restrictive:\r
94 \r
95         notmuch tag -foo tag:foo and not (<foo-specific-search-terms)\r
96 \r
97 I've talked about doing "virtual tags" in the configuration file which\r
98 would implement basically the logic of these two "notmuch tag" commands\r
99 and be configured by simply providing the pair of:\r
100 \r
101         "foo" and <foo-specific-search-terms>\r
102 \r
103 So, that's a slightly-off-topic recommendation for doing global tagging\r
104 rather than tagging based on new messages only. (Sup's support for\r
105 automatic tagging is only for new messages, and I learned there how\r
106 painful it can be to operate like that.)\r
107 \r
108 OK, that was a rather long side-note.\r
109 \r
110 Back to the patch, I do recognize that having "inbox" and "unread"\r
111 hard-coded within "notmuch new" is rather strict. So I'm definitely\r
112 interested in allowing something more flexible here. And I think the\r
113 configuration syntax you came up with makes a lot of sense for that.\r
114 \r
115 > On a side note; It may seem logical to add/omit the tag 'unread' directly=\r
116  in=20\r
117 > 'notmuch new' based on the Maildir flags extracted from the filename of t=\r
118 he\r
119 > message. I suggest that we don't do that in 'notmuch new'. A better way w=\r
120 ould\r
121 > be writing a small script or command that can be run *after* 'notmuch new=\r
122 '.\r
123 > We could then distribute it with notmuch (maybe with other small tagging\r
124 > scripts for common situations).=20\r
125 \r
126 I do appreciate the sentiment here, (provide good support for\r
127 scriptability and let the user use that for extended functionality). But\r
128 the question is, how far do we take that idea? For example, we could\r
129 simply hard-code a single "new" tag and say that anyone that wants\r
130 "inbox" and "unread" on new messages should do:\r
131 \r
132         notmuch tag +inbox +unread -new tag:new\r
133 \r
134 Would that make notmuch a more elegant system, or would it just be\r
135 harder to use than just allowing the inbox and unread tags in the\r
136 configuration file?\r
137 \r
138 > I think Maildir flags should be processed after 'notmuch new' is because =\r
139 if\r
140 > there are multiple copies of a message with different flags, we may need =\r
141 to\r
142 > see all flags from all filenames to set corresponding tags properly and w=\r
143 e may\r
144 > also need to take the directory part into consideration (i.e. the new mai=\r
145 l is\r
146 > in 'new', not 'cur').\r
147 \r
148 I think we're going to have to solve all of these problems anyway. We've\r
149 already got outstanding patches for dealing with message renames. And\r
150 the message rename case is identical to the case of duplicate messages\r
151 with different tags, (differing only in whether both filenames are still\r
152 present in the mail store).\r
153 \r
154 > There is one catch for users who already have a configuration file and st=\r
155 art\r
156 > using the patches. They will need to add the new section and the tags opt=\r
157 ion\r
158 > manually if they want to preserve current behavior of applying 'inbox' and\r
159 > 'unread' automatically by 'notmuch new'.\r
160 \r
161 Why not support backwards compatibility by simply treating an empty\r
162 configuration value as "inbox;unread"? We could even make the\r
163 notmuch-config code notice a case like this and write out the new\r
164 configuration file with the new option explicitly in it, (with\r
165 documentation).\r
166 \r
167 I'd definitely like to see a smooth upgrade path where existing users\r
168 get as much benefit from a complete and well-documented configuration\r
169 file as new users. (I've been frustrated by too many programs where the\r
170 only way to get a well-documented configuration is to start from\r
171 scratch.)\r
172 \r
173 > The last patch in the set adds a new command line option to 'notmuch new'.\r
174 > The name of the option is --tag and it can be used to override any tags\r
175 > configured in the configuration file. For example:\r
176 >=20\r
177 >   notmuch new --tag=3Doutbox --tag=3Dread\r
178 >=20\r
179 > adds the tags 'outbox' and 'read' and ignores any tags from the configura=\r
180 tion\r
181 > file.\r
182 \r
183 I don't like the idea of adding command-line-based tags to "notmuch\r
184 new", at least the way "notmuch new" currently works, (searching through\r
185 a mail store for any new files).\r
186 \r
187 In the actual patch, you identified a use-case for this that is\r
188 important, (importing a new collection of messages and wanting them all\r
189 tagged together). The problem of doing this with the existing "notmuch\r
190 new" is that it's too easy to accidentally tag more than is\r
191 intended. The only way to make it work would be to:\r
192 \r
193         1. Turn off anything delivering mail to the mailstore\r
194 \r
195         2. Ensure that the delivery is actually complete somehow, (and\r
196            not still pending in local MTA queues, etc.)\r
197 \r
198         3. Run "notmuch new" to ensure all recently-delivered mail is\r
199            incorporated.\r
200 \r
201         4. Copy the new collection of mail into the mail store.\r
202 \r
203         5. Run "notmuch new --tag" with the collection-specific tag.\r
204 \r
205         6. Turn on mail delivery again.\r
206 \r
207 That's too hard, and far too error-prone. (I don't know of any good way\r
208 to do step (2) on my system, for example.)\r
209 \r
210 If we had something like "notmuch import" that took files (perhaps even\r
211 an mbox) and copied them into the mail store, then *that* command could\r
212 legitimately accept a --tag option.\r
213 \r
214 Meanwhile, the way I think I'd like to see this operation supported is\r
215 by a search specification that operates on the filenames. People have\r
216 already asked for support for doing tagging based on directory names,\r
217 (which will apparently allow people to keep their collection of\r
218 Gmail-created tags). So I'd like to see something like this instead for\r
219 the use case:\r
220 \r
221         mv some-archive ~/mail-store/some-archive\r
222         notmuch tag +some-archive filename:some-archive*\r
223 \r
224 This idea seems very much in line with what you advocated earlier,\r
225 (handling the maildir "unread" flag after the fact, rather than in\r
226 "notmuch new").\r
227 \r
228 And yes, I realize that I'm arguing on different sides of the issue\r
229 here. Trying to decide how much "notmuch new" should or shouldn't do is\r
230 a tricky thing, and I'm hoping that by arguing from both sides I'll\r
231 better be able to see the right answer. :-)\r
232 \r
233 =2DCarl\r
234 \r
235 --=-=-=\r
236 Content-Type: application/pgp-signature\r
237 \r
238 -----BEGIN PGP SIGNATURE-----\r
239 Version: GnuPG v1.4.10 (GNU/Linux)\r
240 \r
241 iD8DBQFLFt3N6JDdNq8qSWgRAkMqAJ41y78dTqfm4dackN8I5BB7dsFXnwCgpkaA\r
242 m/Wztq3l9qY8UK2ND1cd0fE=\r
243 =frFh\r
244 -----END PGP SIGNATURE-----\r
245 --=-=-=--\r