tagging moved messages
authorEmmanuel Beffara <manu@beffara.org>
Sat, 19 May 2012 15:40:43 +0000 (17:40 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:14 +0000 (09:47 -0800)
4a/719a6a665341b3b75ccbe7edc6bf870fb0c0d7 [new file with mode: 0644]

diff --git a/4a/719a6a665341b3b75ccbe7edc6bf870fb0c0d7 b/4a/719a6a665341b3b75ccbe7edc6bf870fb0c0d7
new file mode 100644 (file)
index 0000000..9917850
--- /dev/null
@@ -0,0 +1,102 @@
+Return-Path: <emmanuel.beffara@univ-amu.fr>\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 6E2DD431FB6\r
+       for <notmuch@notmuchmail.org>; Sat, 19 May 2012 08:49:20 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       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 WpgvgbkTOF+F for <notmuch@notmuchmail.org>;\r
+       Sat, 19 May 2012 08:49:19 -0700 (PDT)\r
+X-Greylist: delayed 557 seconds by postgrey-1.32 at olra;\r
+       Sat, 19 May 2012 08:49:19 PDT\r
+Received: from smtp.univmed.fr (smtp.univmed.fr [139.124.132.70])\r
+       (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id B14B3431FAE\r
+       for <notmuch@notmuchmail.org>; Sat, 19 May 2012 08:49:19 -0700 (PDT)\r
+Received: from localhost (dra13-2-82-237-244-11.fbx.proxad.net\r
+ [82.237.244.11])      by smtp.univmed.fr (Postfix) with ESMTPSA id 52C7D2003E;\r
+       Sat, 19 May 2012 17:39:59 +0200 (CEST)\r
+Date: Sat, 19 May 2012 17:40:43 +0200\r
+From: Emmanuel Beffara <manu@beffara.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: tagging moved messages\r
+Message-ID: <20120519154043.GA7220@chantourne>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Miltered: at smtp.univmed.fr with ID 4FB7BECF.000 by Joe's j-chkmail (http :\r
+       // j-chkmail dot ensmp dot fr)!\r
+X-j-chkmail-Enveloppe: 4FB7BECF.000/82.237.244.11/dra13-2-82-237-244-11.fbx.proxad.net/localhost/<emmanuel.beffara@univ-amu.fr>\r
+X-j-chkmail-Score: MSGID : 4FB7BECF.000 on smtp.univmed.fr : j-chkmail score :\r
+       . : R=. U=. O=## B=0.010 -> S=0.016\r
+X-j-chkmail-Status: Ham\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: Sat, 19 May 2012 15:49:20 -0000\r
+\r
+Hello,\r
+\r
+What would be the proper way of automatically tagging messages whose\r
+file has been renamed?\r
+\r
+My use case is the following:\r
+\r
+In order to have some synchronization of tags between several machines,\r
+I use folders on the IMAP server. The idea is simply that messages\r
+tagged "foo" are actually moved to a folder "foo". The same applies to\r
+the "inbox" tag, and as an exception, messages in a folder named "saved"\r
+are those with no tags. Of course this excludes having several tags on a\r
+given message (except for the special tags like "unread" and "signed"),\r
+but it does fit my needs for now. The post-new hook says this:\r
+\r
+    #!/bin/sh\r
+    for FOLDER in *\r
+    do\r
+        case $FOLDER in\r
+        INBOX) TAG=inbox ;;\r
+        Drafts) TAG=draft ;;\r
+        Trash) TAG=killed ;;\r
+        saved) continue ;;\r
+        *) TAG=$FOLDER\r
+        esac\r
+        notmuch tag -$TAG -- tag:$TAG not folder:$FOLDER\r
+        notmuch tag +$TAG -- folder:$FOLDER not tag:$TAG\r
+    done\r
+\r
+It does work but it is rather slow: 8 seconds, for a collection of 16000\r
+messages. I can live with that but it does involve browsing the whole\r
+collection for each tag. Having a tag on all moved messages, like for\r
+the new ones, would dramatically improve this process.\r
+\r
+Besides, the "folder:" prefix is not an exact search, so the above does\r
+not work well if one folder name is part of another, like if I had a\r
+folder "bar" and a folder "foo.bar". Is there a way around this?\r
+\r
+I have another script called "pre-sync" that moves messages to folders\r
+according to their tags. This one is called before offlineimap does the\r
+full actual synchronization (calling notmuch new after that).\r
+\r
+I welcome any comments on my usage pattern, as there may well be better\r
+approaches I didn't think of...\r
+\r
+-- \r
+Emmanuel\r