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 82D05431FB6 for ; Sun, 6 Mar 2011 13:34:38 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled 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 sPrTmJPAC4+Q for ; Sun, 6 Mar 2011 13:34:37 -0800 (PST) Received: from smtp.nextra.cz (smtp.nextra.cz [212.65.193.3]) by olra.theworths.org (Postfix) with ESMTP id 7D82A431FB5 for ; Sun, 6 Mar 2011 13:34:37 -0800 (PST) Received: from resox.2x.cz (unknown [213.29.198.144]) by smtp.nextra.cz (Postfix) with ESMTP id 05E9A77DFF; Sun, 6 Mar 2011 22:34:34 +0100 (CET) Received: from wsh by resox.2x.cz with local (Exim 4.72) (envelope-from ) id 1PwLap-0000KG-Is; Sun, 06 Mar 2011 22:34:23 +0100 From: Michal Sojka To: Ben Gamari , notmuch Subject: Re: My mail configuration In-Reply-To: <87tyfu3k5a.fsf@gmail.com> References: <87tyfu3k5a.fsf@gmail.com> User-Agent: Notmuch/0.5-103-g1253785 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) Date: Sun, 06 Mar 2011 22:34:13 +0100 Message-ID: <87oc5o0w8a.fsf@resox.2x.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Sun, 06 Mar 2011 21:34:38 -0000 On Wed, 23 Feb 2011, Ben Gamari wrote: > Here is my mail sorting script that has been slowly evolving for almost > a year now. It uses the Python bindings, along with Bogofilter for spam > filtering. There is also an update-spam script which brings the > Bogofilter database in to synchronization with the notmuch tags. On this > note, if someone wants to implement the ability to hide certain tags > (say, those matching /\..+/) in the emacs interface it would be greatly > appreciated. I have notmuch configured such that all new mail starts > with just the "new" tag. The sorting script then takes it from > there. Hope this will give folks some ideas. Hi Ben, thanks for sharing your setup. It seems really interesting and probably useful for many people. I'd propose to put it to wiki at http://notmuchmail.org/initial_tagging/. When compared to shell scripts for initial tagging, this seems to be much faster because of freezing all new messages and thawing them after all tagging is done. Also the handling of watch and unseen tag is interesting. The only thing I missed in your email is the definition of tag_search(). You probably define it in notmuch_utils similarly to this: def tag_search(db, query, *tags): logging.debug('tagging %s %s' % (query, tags)) q = notmuch.Query(db, query) for msg in q.search_messages(): for tagop in tags: if tagop[0] == '+': msg.add_tag(tagop[1:]) elif tagop[0] == '-': msg.remove_tag(tagop[1:]) else: msg.add_tag(tagop) > # Tag things > for filter, tags in _tags: > tag_search(db, '%s and tag:new' % filter, *tags) Here I would suggest to add parentheses around %s like: tag_search(db, '( %s ) and tag:new' % filter, *tags) I use the 'or' operator in a few of my filters and without the parentheses the query would be interpreted incorrectly. -Michal