Re: [notmuch] Initial tagging
authorCarl Worth <cworth@cworth.org>
Fri, 26 Feb 2010 01:02:08 +0000 (17:02 +1600)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:17 +0000 (09:36 -0800)
5c/6c383a02ec86d4ae7456d80c4b3a2702079a2d [new file with mode: 0644]

diff --git a/5c/6c383a02ec86d4ae7456d80c4b3a2702079a2d b/5c/6c383a02ec86d4ae7456d80c4b3a2702079a2d
new file mode 100644 (file)
index 0000000..eeaaa28
--- /dev/null
@@ -0,0 +1,205 @@
+Return-Path: <cworth@cworth.org>\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 DB56D431FBC\r
+       for <notmuch@notmuchmail.org>; Thu, 25 Feb 2010 17:02:14 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -3.284\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-3.284 tagged_above=-999 required=5\r
+       tests=[ALL_TRUSTED=-1.8, AWL=1.115, BAYES_00=-2.599] autolearn=ham\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 mmRj11WXOaGw; Thu, 25 Feb 2010 17:02:12 -0800 (PST)\r
+Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id AFA2A431FAE;\r
+       Thu, 25 Feb 2010 17:02:12 -0800 (PST)\r
+Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
+       id B429925427B; Thu, 25 Feb 2010 17:02:08 -0800 (PST)\r
+From: Carl Worth <cworth@cworth.org>\r
+To: James Vasile <james@hackervisions.org>, notmuch@notmuchmail.org\r
+In-Reply-To: <87hbp5j9dv.fsf@hackervisions.org>\r
+References: <87hbp5j9dv.fsf@hackervisions.org>\r
+Date: Thu, 25 Feb 2010 17:02:08 -0800\r
+Message-ID: <87r5o8stbj.fsf@yoom.home.cworth.org>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha1; protocol="application/pgp-signature"\r
+Subject: Re: [notmuch] Initial tagging\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, 26 Feb 2010 01:02:15 -0000\r
+\r
+--=-=-=\r
+\r
+On Thu, 25 Feb 2010 16:25:16 -0500, James Vasile <james@hackervisions.org> wrote:\r
+> I'm curious as to what people are doing in this regard.\r
+\r
+I'm currently using a script that does tagging not entirely unlike\r
+yours, (though my script isn't clever to retry a call to\r
+notmuch---believe it or not I'm just calling it manually still, not from\r
+cron).\r
+\r
+> The tagging script uses the inbox tag to identify new mail, tags it\r
+> according to criteria, then removes the inbox tag from anything it found\r
+> a match for.  Uncategorized mail keeps the inbox tag so I can inspect it\r
+> later and make rules for it (or tag it manually).\r
+\r
+One distinction is that I have all of my "notmuch tag" commands operate\r
+globally rather than just on new messages. One of the things that really\r
+annoyed be about sup was that the support for automatic tagging worked\r
+as a hook on messages as they were processed. So I couldn't use any of\r
+the tags for searches prior to the time that I had added a particular\r
+tag rule. I definitely didn't want to replicate that bug.\r
+\r
+I also don't remove the inbox tag from matched mail, since I have a\r
+"notmuch-folders" configuration that takes advantage of the matched tags\r
+in concert with the inbox tag.\r
+\r
+I've included my current auto-tagging script (notmuch-poll) below, as\r
+well as the snippet of my .emacs that sets my notmuch-folders variable.\r
+\r
+> Also, prepending "tag:inbox and" to search criteria restricts the\r
+> tagging to a small subset of the db, which makes the tagging script run\r
+> fairly quickly.  My unexpurgated tagging script has almost 100 rules for\r
+> tagging, and I expect it to grow over time.\r
+\r
+To do my "global" searches quickly, I do a similar subsetting, but it's\r
+much simpler. If I'm adding the "notmuch" tag I do "and not\r
+tag:notmuch". We've even had the proposal of making "notmuch tag" do\r
+that automatically.\r
+\r
+Meanwhile, I'm planning on eventually moving entirely away from any tags\r
+that are driven entirely by searches like this. Instead, I'd like to\r
+just have good support for "saved searches" where we have some syntax to\r
+perform string expansion on configured search terms. So where I'm\r
+currently doing:\r
+\r
+       notmuch search tag:notmuch\r
+\r
+I could instead do:\r
+\r
+       notmuch search query:notmuch\r
+\r
+with a configuration associating "notmuch" to "to:notmuchmail.org" and\r
+the above would expand to:\r
+\r
+       notmuch search '(' to:notmuchmail.org ')'\r
+\r
+We've been talking about these saved searches for a while, but we\r
+haven't implemented them yet, (nor decided firmly on the syntax we\r
+want). I just noticed today that sup recently added a similar\r
+saved-search feature with the following syntax:\r
+\r
+       notmuch search {notmuch}\r
+\r
+I think I might like something like that with more custom syntax, (since\r
+the existing "prefix:" syntax has a fairly standard meaning that doesn't\r
+fit well with this new feature.\r
+\r
+With saved-search support in notmuch, I could get rid of my notmuch-poll\r
+script almost entirely, (I'd still want something to automatically\r
+remove the -inbox tag from some messages, but that's about it).\r
+\r
+-Carl\r
+\r
+##### notmuch-poll #####\r
+echo "Importing new mail"\r
+notmuch new\r
+\r
+echo "Running global tag additions to tag new mail"\r
+\r
+# Tag bug-mail first, (since we use the bugs tag below)\r
+notmuch tag +bugs from:bugzilla-daemon and not tag:bugs\r
+\r
+# Note mail sent specifically to me (excluding bug mail)\r
+notmuch tag +to-me to:cworth@cworth.org and not tag:to-me and not tag:bugs\r
+notmuch tag +to-me to:carl@theworths.org and not tag:to-me and not tag:bugs\r
+notmuch tag +to-me to:carl.d.worth@intel.com and not tag:to-me and not tag:bugs\r
+\r
+# And note all mail sent from me\r
+notmuch tag +sent from:cworth@cworth.org and not tag:sent\r
+notmuch tag +sent from:carl@theworths.org and not tag:sent\r
+notmuch tag +sent from:carl.d.worth@intel.com and not tag:sent\r
+\r
+# Intel mail deserves some distinction\r
+notmuch tag +intel to:carl.d.worth@intel.com and not tag:intel\r
+notmuch tag +intel from:intel.com and not tag:intel\r
+notmuch tag +intel to:intel-gfx and not tag:intel\r
+notmuch tag +intel to:linux-gfx and not tag:intel\r
+\r
+# Next, various free-software projects tagged by recipient\r
+notmuch tag +cairo to:cairographics.org and not tag:cairo\r
+notmuch tag +cairo to:pixman@lists.freedesktop.org and not tag:cairo\r
+notmuch tag +xorg-board to:foundation.x.org and not tag:xorg-board\r
+notmuch tag +xorg to:xorg and not tag:xorg\r
+notmuch tag +xorg to:xcb and not tag:xorg\r
+notmuch tag +announce to:announce@lists.debian.org and not tag:announce\r
+notmuch tag +debian to:lists.debian.org and not tag:debian\r
+notmuch tag +sup to:sup-devel@rubyforge.org and not tag:sup\r
+notmuch tag +lca to:lists.lca2010.org.nz and not tag:lca\r
+notmuch tag +notmuch to:notmuchmail.org and not tag:notmuch\r
+notmuch tag +nickle to:nickle.org and not tag:nickle\r
+notmuch tag +meego '( to:dev@moblin.org or to:dev@lists.moblin.org or to:meego-dev@meego.com )' and not tag:meego\r
+\r
+# Finally, a few subject-based tags\r
+notmuch tag +intel subject:xf86-video-intel and not tag:intel\r
+notmuch tag +sup subject:sup-talk and not tag:sup\r
+notmuch tag +pdx subject:pdx and not tag:pdx\r
+\r
+# And some sender-based tags\r
+notmuch tag +family from:theworths.org and not tag:family'\r
+\r
+# Keep most Debian bug traffic out of my inbox\r
+notmuch tag +debbugs '(' to:bugs.debian.org or from:bugs.debian.org ')' and not tag:debbugs\r
+notmuch tag -inbox tag:inbox and tag:debbugs and not '(' '"Package: cairo"' or '"Package: notmuch"' ')'\r
+\r
+echo "Done."\r
+\r
+##### a snippet of .emacs #####\r
+(setq notmuch-folders '(("inbox" . "tag:inbox")\r
+                       ("tome" . "tag:inbox and (tag:to-me or tag:family)")\r
+                       ("tome-select" . "tag:inbox and (tag:to-me or tag:family) and not tag:notmuch and not tag:cairo")\r
+                       ("other" . "tag:inbox AND not (tag:to-me or tag:announce or tag:notmuch or tag:intel or tag:bugs or tag:cairo or tag:xorgboard or tag:xorg or tag:debian or tag:sup or tag:lca or tag:meego or tag:nickle or tag:pdx)")\r
+                       ("announce" . "tag:inbox AND tag:announce")\r
+                       ("notmuch" . "tag:inbox AND tag:notmuch")\r
+                       ("intel" . "tag:inbox AND tag:intel")\r
+                       ("bugs" . "tag:inbox AND tag:bugs")\r
+                       ("cairo" . "tag:inbox AND tag:cairo")\r
+                       ("xorgboard" . "tag:inbox AND tag:xorg-board")\r
+                       ("xorg" . "tag:inbox AND tag:xorg")\r
+                       ("debian" . "tag:inbox AND tag:debian")\r
+                       ("sup" . "tag:inbox AND tag:sup")\r
+                       ("lca" . "tag:inbox AND tag:lca")\r
+                       ("meego" . "tag:inbox AND tag:meego")\r
+                       ("nickle" . "tag:inbox AND tag:nickle")\r
+                       ("pdx" . "tag:inbox AND tag:pdx")\r
+                       ("todo" . "tag:todo and not tag:cairo and not tag:notmuch and not tag:intel")\r
+                       ("inteltodo" . "(tag:todo and tag:intel) or tag:todo-intel")\r
+                       ("notmuchtodo" . "(tag:todo and tag:notmuch) or tag:todo-notmuch")\r
+                       ("cairotodo" . "(tag:todo and tag:cairo) or tag:todo-cairo")\r
+                       ))\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.10 (GNU/Linux)\r
+\r
+iD8DBQFLhx2Q6JDdNq8qSWgRAsa3AKCR2jtPtckrF79hQQ0bdLw129w+KACePw4A\r
+bBuRWhs1I+LVaxwudPw7ysA=\r
+=wClM\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r