--- /dev/null
+Return-Path: <MarkR.Anderson@amd.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id D5F71431FAF\r
+ for <notmuch@notmuchmail.org>; Fri, 14 Sep 2012 09:27:38 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id wsI8OPNDsxp2 for <notmuch@notmuchmail.org>;\r
+ Fri, 14 Sep 2012 09:27:36 -0700 (PDT)\r
+Received: from db3outboundpool.messaging.microsoft.com\r
+ (db3ehsobe001.messaging.microsoft.com [213.199.154.139])\r
+ (using TLSv1 with cipher AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id B8A8F431FAE\r
+ for <notmuch@notmuchmail.org>; Fri, 14 Sep 2012 09:27:35 -0700 (PDT)\r
+Received: from mail26-db3-R.bigfish.com (10.3.81.250) by\r
+ DB3EHSOBE004.bigfish.com (10.3.84.24) with Microsoft SMTP Server id\r
+ 14.1.225.23; Fri, 14 Sep 2012 16:27:34 +0000\r
+Received: from mail26-db3 (localhost [127.0.0.1]) by mail26-db3-R.bigfish.com\r
+ (Postfix) with ESMTP id 5FDC9400A9;\r
+ Fri, 14 Sep 2012 16:27:34 +0000 (UTC)\r
+X-Forefront-Antispam-Report: CIP:163.181.249.108; KIP:(null); UIP:(null);\r
+ IPV:NLI; H:ausb3twp01.amd.com; RD:none; EFVD:NLI\r
+X-SpamScore: -13\r
+X-BigFish: VPS-13(zzbb2dI98dI154cP9371I1432I4015I1415Id6f1izz1202h1d1ah1d2ahzz8275ch17326ah8275bh8275dhz2dh668h839h944hd24hf0ah1220h1288h12a5h12a9h12bdh1155h)\r
+Received: from mail26-db3 (localhost.localdomain [127.0.0.1]) by mail26-db3\r
+ (MessageSwitch) id 1347640053311330_2169;\r
+ Fri, 14 Sep 2012 16:27:33 +0000 (UTC)\r
+Received: from DB3EHSMHS005.bigfish.com (unknown [10.3.81.233]) by\r
+ mail26-db3.bigfish.com (Postfix) with ESMTP id 3EF501E0071;\r
+ Fri, 14 Sep 2012 16:27:33 +0000 (UTC)\r
+Received: from ausb3twp01.amd.com (163.181.249.108) by\r
+ DB3EHSMHS005.bigfish.com (10.3.87.105) with Microsoft SMTP Server id\r
+ 14.1.225.23; Fri, 14 Sep 2012 16:27:31 +0000\r
+X-WSS-ID: 0MACLPT-01-A9J-02\r
+X-M-MSG: \r
+Received: from sausexedgep01.amd.com (sausexedgep01-ext.amd.com\r
+ [163.181.249.72]) (using TLSv1 with cipher AES128-SHA (128/128\r
+ bits)) (No\r
+ client certificate requested) by ausb3twp01.amd.com (Axway MailGate\r
+ 3.8.1)\r
+ with ESMTP id 275DA10280AB; Fri, 14 Sep 2012 11:27:29 -0500 (CDT)\r
+Received: from sausexhtp01.amd.com (163.181.3.165) by sausexedgep01.amd.com\r
+ (163.181.36.54) with Microsoft SMTP Server (TLS) id 8.3.192.1;\r
+ Fri, 14 Sep 2012 11:41:23 -0500\r
+Received: from adcvmail01.amd.com (163.181.21.78) by sausexhtp01.amd.com\r
+ (163.181.3.165) with Microsoft SMTP Server (TLS) id 8.3.213.0;\r
+ Fri, 14 Sep 2012 11:27:29 -0500\r
+Received: from brewmaster.amd.com (brewmaster.amd.com [165.204.144.45]) by\r
+ adcvmail01.amd.com (8.13.8/8.13.8) with ESMTP id q8EGRP6i011196;\r
+ Fri, 14 Sep 2012 11:27:25 -0500\r
+Received: from testarossa.amd.com (testarossa.amd.com [165.204.147.44]) by\r
+ brewmaster.amd.com (8.13.8/8.13.8) with ESMTP id q8EGRSYK005287;\r
+ Fri, 14 Sep 2012 10:27:28 -0600\r
+Received: (from manderso@localhost) by testarossa.amd.com\r
+ (8.13.8/8.13.8/Submit) id q8EGRND8031091;\r
+ Fri, 14 Sep 2012 10:27:23 -0600\r
+X-Authentication-Warning: testarossa.amd.com: manderso set sender to\r
+ MarkR.Anderson@amd.com using -f\r
+From: Mark Anderson <MarkR.Anderson@amd.com>\r
+To: Rainer M Krug <R.M.Krug@gmail.com>, <notmuch@notmuchmail.org>\r
+Subject: Re: Better Gmail handling by not using Notmuch tags\r
+In-Reply-To: <5052E1A9.8060503@gmail.com>\r
+References:\r
+ <CA+y5gghe68Sy6BK8FdeGbKEESFD_=2GQ+y+oZSYyt85oQqRuzA@mail.gmail.com>\r
+ <CA+eQo_0nK1rL6DYu2ERqF3U=vZAO_XTpXDtzydHQqBtXqHUOxQ@mail.gmail.com>\r
+ <CA+y5gghnzinnXiabFOEphAuWTJA5Uge9RtGbKu9ur5rP50i_5g@mail.gmail.com>\r
+ <5052E1A9.8060503@gmail.com>\r
+User-Agent: Notmuch/0.11.1+251~g1093c24 (http://notmuchmail.org) Emacs/23.2.1\r
+ (i686-pc-linux-gnu)\r
+Date: Fri, 14 Sep 2012 10:27:23 -0600\r
+Message-ID: <3wda9ws4ljo.fsf@testarossa.amd.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset="us-ascii"\r
+X-OriginatorOrg: amd.com\r
+Cc: Jeremy Nickurak <public-not-much-kexSNQTsIoD754YsiR0rpA@plane.gmane.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 14 Sep 2012 16:27:39 -0000\r
+\r
+On Fri, 14 Sep 2012 09:50:01 +0200, Rainer M Krug <R.M.Krug@gmail.com> wrote:\r
+> -----BEGIN PGP SIGNED MESSAGE-----\r
+> Hash: SHA1\r
+> \r
+> On 13/09/12 17:15, Damien Cassou wrote:\r
+> > On Thu, Sep 13, 2012 at 5:13 PM, Jeremy Nickurak \r
+> > <not-much@trk.nickurak.ca> wrote:\r
+> >> Gmail doesn't have folders, of course, it has labels, which are\r
+> >> approximately equivalent to notmuch tags. The key difference being\r
+> >> that a message can only be in one folder, but it can have multiple\r
+> >> tags/labels.\r
+> > \r
+> > Gmail exports its labels as IMAP folders: an email with multiple\r
+> > labels will be duplicated in multiple folders (one per\r
+> > label). That's why I'm asking if it would be possible to manupale\r
+> > folders from Notmuch instead of tags.\r
+> > \r
+> \r
+> I don't think there is an easy solution. notmuch uses a maildir and\r
+> tags. Gmail needs to be synced to this local maildir earlier, and this\r
+> is where I think the problem comes in: I am not aware of any sync tool\r
+> which maintains the gmail labels, as they are in in the imap context\r
+> folders.\r
+> \r
+> I think the only real solution woud be:\r
+> \r
+> Download from gmail -> local:\r
+> 1) download only the "All Mail" folder\r
+> 2) implement a tagging tool which syncs the gmail labels to notmuch tags\r
+\r
+Gmail's IMAP protocol does expose a folder hierarchy which you can use\r
+to reverse engineer the tag cloud of each email. \r
+\r
+Using Offlineimap will happily sync a your Gmail such that each mail\r
+will show up in every folder corresponding to the tags with which the\r
+mail is tagged. When notmuch scans the mail, it will collapse these\r
+multiple mails into one mail message by message-id: and you just need a\r
+script to translate folders into tags. The incoherence between notmuch\r
+tag and mail folders then communicates something different if you are\r
+pre-sync or post-sync. I am calling the offlineimap call "sync", so once\r
+we run it (the first time for sure) we are in 'post-sync'.\r
+\r
+\r
+You might want to take this chance to make your tag cloud coherent\r
+between Notmuch and what exists in the folders, which works out to\r
+something like this for every tag/folder pair in your gmail IMAP\r
+directory (assuming it's synced to a Maildir repository) and notmuch DB.\r
+\r
+ notmuch tag +TagX folder:FolderX and not tag:TagX \r
+\r
+Although strictly speaking it isn't actually necessary to put the \r
+"and not tag:TagX" term, as this term this is now implicitly added by\r
+notmuch to improve performance and avoid touching database entries that\r
+already have the tag, I include it to demonstrate the coherence between\r
+TagX and FolderX.\r
+\r
+Then you'll want to handle TagX being removed on the Gmail side too,\r
+so you'll want to do something like this to remove the notmuch TagX.\r
+ \r
+ notmuch tag -TagX tag:TagX and not folder:FolderX\r
+\r
+Then there's the reverse direction to consider.\r
+\r
+When I see TagX in notmuch, and using FolderX as the proxy for Gmail\r
+tags, then I assume that the user added TagX in notmuch and I need to\r
+synchronize the change. This one is a bit trickier.\r
+\r
+ notmuch search --output=files tag:TagX and not folder:FolderX \r
+\r
+will give me the list of filenames, but I need to add them to a folder,\r
+so it's time for bash, or your favorite script language. Spaces in\r
+filenames or tags are your bane here, then you'll want to do something\r
+fancier than just the $() interpolation.\r
+\r
+notmuch search --output=files tag:notmuch and not folder:notmuch |\r
+xargs perl -e'while (defined($_ = shift(@ARGV))) {my $file =\r
+filename($_); system("cp $_ $MAILDIR/notmuch/cur/$file");}'\r
+\r
+Then when I see a mail in FolderX without TagX, that indicates that I\r
+have removed the tag from notmuch, so I will want to remove the copy of\r
+the file from FolderX, and only FolderX.\r
+\r
+This requires you to scan through the list of filenames associated with\r
+the msg-id and delete the file in FolderX.\r
+\r
+Of course this is terrible on performance, as you will have lots of\r
+copies of mails when you have lots of tags on your mail, but here's a\r
+summary of the actions you need to coordinate to keep them in sync.\r
+\r
+\r
+Stage FolderX TagX Action\r
+===== ======= ==== ======\r
+post-sync No No No Action\r
+\r
+post-sync No Yes Gmail TagX removed caused FolderX copy\r
+ to be removed, remove Notmuch TagX\r
+\r
+post-sync Yes No Gmail TagX added, add Notmuch TagX\r
+\r
+post-sync Yes Yes No Action\r
+\r
+pre-sync No No No Action\r
+\r
+pre-sync No Yes Notmuch TagX added, copy mail to FolderX\r
+ to add Gmail TagX corresponding to\r
+ notmuch TagX \r
+\r
+pre-sync Yes No Notmuch TagX removed, delete mail copy\r
+ in FolderX\r
+\r
+pre-sync Yes Yes No Action\r
+\r
+The worst part about this, is that any interrupted action must be\r
+retried until successful, unless we have information about the relative\r
+times of the actions. If instead of trying to rationalize the two\r
+"states" of my messages, I was trying to synchronize the changes, then I\r
+just need to go down the list of changes and take the appropriate action.\r
+\r
+You might have other actions, such as a true delete in Notmuch, which\r
+should remove all copies of the email before doing a mail sync.\r
+\r
+The benefit of using the mail sync is it uses a widely distributed mail\r
+synchronization model, but it really tags expensive to synchronize. It\r
+gets better if you use the Gmail imap extensions that can list the tags\r
+without your client requesting a copy of the entire email for each tag\r
+the mail has. However, Even when you have that, you don't have\r
+bulletproof mail, because the actions need to be guaranteed to complete\r
+before synchronization and after synchronization, and any user changes\r
+need to be held off, as they _will_ be interpreted incorrectly if they\r
+take place during the pre-sync, sync, post-sync window.\r
+\r
+You can simplify this if you make guarantees in your usage model. That\r
+you will never do tagging operations during a pre-, sync, post- cycle,\r
+or that you only do synchronization one way or the other, instead of\r
+full bidirectional sync.\r
+\r
+It's a difficult problem, I look forward to seeing other solutions\r
+proposed.\r
+\r
+Thanks,\r
+-Mark Anderson\r
+\r
+> upload local -> gmail\r
+> 1) upload "All Mail folder\r
+> 2) assign on gmail the labels corresponding to the notmuch tags.\r
+> \r
+> The step 1 could be done by any sync tool available for this (offlineimap, ...)\r
+> \r
+> step 2 needs to be developed - no idea how, but it surely would be really usefull, because then\r
+> notmuch would even become a perfect tool for gmail backup as well.\r
+> \r
+> Cheers,\r
+> \r
+> Rainer\r
+> -----BEGIN PGP SIGNATURE-----\r
+> Version: GnuPG v1.4.11 (GNU/Linux)\r
+> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/\r
+> \r
+> iEYEARECAAYFAlBS4akACgkQoYgNqgF2egoGhwCaAgfXQUAK4RK1v22JOhgYXfR1\r
+> +C8AnRU892SrxK7IYN9xoxhM865Y+vTA\r
+> =ma75\r
+> -----END PGP SIGNATURE-----\r
+> \r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r
+> \r
+\r