--- /dev/null
+Return-Path: <david@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 3B4536DE0274\r
+ for <notmuch@notmuchmail.org>; Sun, 10 Jan 2016 05:59:35 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.31\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.31 tagged_above=-999 required=5 tests=[AWL=0.241, \r
+ RP_MATCHES_RCVD=-0.55, SPF_PASS=-0.001] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id rsxUSEUFlrar for <notmuch@notmuchmail.org>;\r
+ Sun, 10 Jan 2016 05:59:33 -0800 (PST)\r
+Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 427276DE0261\r
+ for <notmuch@notmuchmail.org>; Sun, 10 Jan 2016 05:59:33 -0800 (PST)\r
+Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
+ (envelope-from <david@tethera.net>)\r
+ id 1aIGWe-0006rI-NR; Sun, 10 Jan 2016 08:59:20 -0500\r
+Received: (nullmailer pid 8729 invoked by uid 1000);\r
+ Sun, 10 Jan 2016 13:59:28 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: Igor Almeida <igor.contato@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH/RFC 0/3] Maildir custom flags and notmuch tags\r
+In-Reply-To: <1448504191-30974-1-git-send-email-igor.contato@gmail.com>\r
+References: <1448504191-30974-1-git-send-email-igor.contato@gmail.com>\r
+User-Agent: Notmuch/0.21+26~g9404723 (http://notmuchmail.org) Emacs/24.5.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sun, 10 Jan 2016 09:59:28 -0400\r
+Message-ID: <87mvsd7cxr.fsf@zancas.localnet>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 10 Jan 2016 13:59:35 -0000\r
+\r
+Igor Almeida <igor.contato@gmail.com> writes:\r
+\r
+> Building on Bremner's patch at\r
+> <1411805835-3563-1-git-send-email-david@tethera.net>, this updates\r
+> 'notmuch new' to tag messages based on lower-case letters in the file\r
+> name.\r
+> I'm testing this with an IMAP server, offlineimap and notmuch,\r
+> and seems to work well enough for my unidirectional use case.\r
+> Eventually I'd like to implement the reverse path, i.e. tagging in\r
+> notmuch and seeing IMAP keywords show up in the server, but that's for\r
+> later.\r
+>\r
+> Comments are very welcome.\r
+>\r
+\r
+Sorry about the long silence. I _have_ been thinking about and working\r
+on this. This message summarizes my current thinking/plan.\r
+\r
+I'm not very enthusiastic about the about the several places this can\r
+get out of sync\r
+\r
+1) config info in .notmuch-config can be out of sync with the "real\r
+config" in the database. This part is only until the next run of\r
+notmuch new, so it's not so bad.\r
+\r
+2) When the interpretation of maildir flags changes, there doesn't seem\r
+to be a sensible way of retagging messages.\r
+\r
+Some others have objected to supporting a nonstandard extension used (I\r
+think) only by dovecot. For me this is not so bad, as long as the code\r
+required specifically for this is not too large / intrusive.\r
+\r
+So here are the pieces I think we need. \r
+\r
+a) some code in notmuch-new to sync flags a-z to a fixed set of tags\r
+ [1]. This soundspretty much the functionality you have now, although I\r
+ haven't really reviewed that part of the series.\r
+\r
+b) some code to update metadata directly from the CLI (notmuch\r
+ config/notmuch tag), probably using something like [2] as a back\r
+ end. This metadata maps the fixed tags like $maildir_flag_k to and\r
+ from some friendly format.\r
+\r
+c) The use of xapian field processors to translate e.g. a query\r
+ "tag:my-sensible-thing" into "tag:$maildir_flag_k". Optionally do the\r
+ reverse when returning lists of tags. FieldProcessors are only\r
+ available in Xapian 1.3.x, but apparently 1.3 series is nearing a\r
+ stable release, so it's a sane time to optionally depend on it.\r
+ I guess as a short term hack, this could be done by shell wrappers\r
+ (not something we'd ship, but it might make it usable for you). \r
+\r
+d) code to dump and restore the metadata as part of the normal dump\r
+ files. This is at least in progress [2].\r
+\r
+In terms of how these changes relate to other goals\r
+\r
+b,d) have strong connects with allowing database level config. Among\r
+ other reasons this will help make bindings users less second class\r
+ citizens\r
+ \r
+\r
+ c) has overlap with allowing date fields that are not ranges (among\r
+ other things). At least all the machinery to configure xapian 1.2\r
+ versus 1.3, and the understanding how to use field processors, is\r
+ reusable.\r
+\r
+I'd understand perfectly if you prefer to rebase your simpler solution\r
+on top of master, but if you want to keep working on this, then I guess\r
+(a), (b), and (c) are all things you would work on.\r
+\r
+Probably (b) needs the library api from [2], which now that I start\r
+typing this epic long message, I could split off from the dump/restore\r
+stuff. In particular managing the config metadata only needs about half\r
+of the LOC; the iterator is only needed for dump, I think.\r
+\r
+David\r
+\r
+[1]: eventually it might make sense to split the tags that are somehow\r
+automatic from those that represent user choice. We already have this\r
+issue with tag:encrypted and friends.\r
+\r
+[2]: id:1452394301-29499-1-git-send-email-david@tethera.net\r