Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 03 / 3a24970fce43fafd9d6e43bd4dd09ef47fb128
1 Return-Path: <michiel@michielbuddingh.net>\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 C0A8F431FC0\r
6         for <notmuch@notmuchmail.org>; Thu, 26 Nov 2009 13:12:02 -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 O36BZb+Q8qNm for <notmuch@notmuchmail.org>;\r
11         Thu, 26 Nov 2009 13:12:01 -0800 (PST)\r
12 Received: from aegir.org.uk (aegir.org.uk [87.238.170.13])\r
13         by olra.theworths.org (Postfix) with ESMTP id 96D1F431FBC\r
14         for <notmuch@notmuchmail.org>; Thu, 26 Nov 2009 13:12:01 -0800 (PST)\r
15 Received: from localhost.localdomain (109-9-ftth.onsnetstudenten.nl\r
16         [145.120.9.109])\r
17         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
18         (No client certificate requested)\r
19         by aegir.org.uk (Postfix) with ESMTPSA id 842BB2E04E;\r
20         Thu, 26 Nov 2009 22:12:00 +0100 (CET)\r
21 Date: Thu, 26 Nov 2009 22:12:02 +0100\r
22 From: Michiel Buddingh' <michiel@michielbuddingh.net>\r
23 To: notmuch@notmuchmail.org, cworth@cworth.org\r
24 Message-ID: <4b0eef22.JwxdgTGElffx149F%michiel@michielbuddingh.net>\r
25 References: <87fx8bygi7.fsf@linux.vnet.ibm.com>\r
26         <87bpiv4t9h.fsf@yoom.home.cworth.org>\r
27         <87y6lz39nd.fsf@yoom.home.cworth.org>\r
28         <20091121221207.GB17268@jukie.net>\r
29         <9cce5525b093b87fe74d427954ffad89@localhost>\r
30         <87d43b2oif.fsf@yoom.home.cworth.org>\r
31         <9bfdedddeab9c58cd45d8d448323d0fc@localhost>\r
32         <87skc23327.fsf@yoom.home.cworth.org>\r
33 In-Reply-To: <87skc23327.fsf@yoom.home.cworth.org>\r
34 User-Agent: Heirloom mailx 12.4 7/29/08\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain; charset=us-ascii\r
37 Content-Transfer-Encoding: 7bit\r
38 Subject: Re: [notmuch] [PATCH] notmuch: Add Maildir directory name as tag\r
39         name for messages\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.12\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Thu, 26 Nov 2009 21:12:03 -0000\r
53 \r
54 Carl Worth <cworth@cworth.org> wrote:\r
55 > > +    " The other value is 'storage_type', which can currently be set to\n"\r
56 > > +    " 'maildir' or 'none'.\n";\r
57 >\r
58 > This part of the patch I don't like. I've got a mail collection spanning\r
59 > over a decade, and it's seen a lot of strange things. Most of my mail is\r
60 > in maildir format, but not quite all of it. And I actually like the\r
61 > ability to just shove random new messages into the mail store manually\r
62 > without having to create a maildir name for it.\r
63 >\r
64 > So I don't think a global configuration makes sense here. Meanwhile,\r
65 > it's really easy to detect the presence of a maildir. Whenever we see\r
66 > child directories of "cur", "new", and "tmp" then we should turn on the\r
67 > processing of maildir flags for when processing mail in "cur" and "new".\r
68 \r
69   I considered that approach; ideally, we could test for the presence of\r
70 all three of cur, tmp and new--but this is rather messy to do in the\r
71 current treewalk structure.  Taking any one of them as proof positive of\r
72 a Maildir might lead to unpleasant surprises--it's not all that incon-\r
73 ceivable for someone to name a mail folder 'tmp'.\r
74 \r
75   There's another matter; Some mail stores will place (large) index files\r
76 in folder roots, i.e. one level above cur/, tmp/ and new/.  Looking\r
77 at the ones dovecot (an IMAP server) uses, I can make out a from header,\r
78 a subject header, and a message-id, as plaintext in the first 100k or\r
79 so.  It's not all that inconceivable that notmuch might register it as\r
80 a 'real' email, with unpleasant consequences for the index.\r
81 \r
82   I've seen some patches fly by that add support for multiple mail\r
83 stores.  Turning on Maildir support on a per-directory basis might\r
84 resolve that problem while still supporting heterogenous mail archives\r
85 to some degree.  I am not convinced we can do the right thing\r
86 automatically without causing some grief to a subset of users.\r
87 \r
88 > > @@ -257,7 +262,7 @@ notmuch_config_open (void *ctx,\r
89 > >         talloc_free (email);\r
90 > >     }\r
91 > >      }\r
92 > > -\r
93 > > +    \r
94 > >      /* When we create a new configuration file here, we  add some\r
95 > >       * comments to help the user understand what can be done. */\r
96 > >      if (is_new) {\r
97 >\r
98 > [nit] Trailing whitespace inserted there as well.\r
99 \r
100 > Hmm... I was going to say that git ships with a pre-commit hook you can\r
101 > turn on that checks for trailing whitespace and aborts the commit if\r
102 > it's present. But it looks like the currently shipping pre-commit.sample\r
103 > hook doesn't do this anymore.\r
104 \r
105 Haven't tested it, but it seems you can put\r
106 \r
107 [core]\r
108     whitespace = trailing-space,space-before-tab\r
109 \r
110 into your ~/.gitconfig now.  I've also set emacs to mark trailing\r
111 whitespace with big red markers.\r
112 \r
113 > OK, now we're into the meat of things. Clearly, you're directly\r
114 > supporting the documented flags of maildir. But we need to do a few\r
115 > things differently here. Most importantly, notmuch is already using an\r
116 > "unread" tag, so maildir's S flag should map that *that* rather than\r
117 > adding new "unseen" and "seen" flags. So messages with the S flag would\r
118 > not get the "unread" tag and messages without S would get the "unread"\r
119 > tag.\r
120 \r
121 When writing the patch, I assumed there might be a minor (but important)\r
122 distinction between marking a mail 'seen' (i.e. the MUA storing the fact\r
123 that the file has been visited) and 'read' (i.e. the user marking the\r
124 contents of a mail as being read and understood).  As I found out later,\r
125 notmuch's interpretation of 'read' and 'unread' is the former, so there\r
126 is no distinction.\r
127 \r
128 > The "flagged" and "replied" tags seem reasonable enough. But for\r
129 > "trashed" and "passed" I think I'd rather see the tag names as "deleted"\r
130 > and "forwarded". (Since I can imagine adding commands to notmuch for\r
131 > "delete" and "forward" but not for "trash" nor "pass").\r
132 \r
133 Fair enough.\r
134 \r
135 > Oh, and setting the "inbox" tag correctly here based on the maildir tags\r
136 > is the final and most important thing. It looks like that's missing from\r
137 > the above. So, a missing "S" flag should map to adding both the "inbox"\r
138 > and "unread" tags.\r
139 \r
140 Makes sense, will do.\r
141 \r
142 > > +       if (state->storage_type == MAILDIR) {\r
143 > > +           char * leaf = basename(next);\r
144 >\r
145 > You could save the basename call by examining the leaf name when it is\r
146 > available as a standalone string up in the caller.\r
147 \r
148 Which would require testing with S_ISDIR twice, which is uglier, but\r
149 essentially free, so I'll grant it's the better thing to do.\r
150 \r
151 > So this patch is close, but needs a few fixes.\r
152 \r
153 I'll be happy to implement them, although I'd like for others to chime\r
154 in on the configure-as-Maildir vs. autodetect-Maildir issue.  And thanks\r
155 for your patience in working through my patch.\r
156 \r
157 -- \r
158 Michiel Buddingh'\r