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