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 4CD1C431FB6 for ; Sat, 16 Apr 2011 05:59:41 -0700 (PDT) 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 PL90WIdPy5VQ for ; Sat, 16 Apr 2011 05:59:39 -0700 (PDT) Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com [74.125.82.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 410E4431FB5 for ; Sat, 16 Apr 2011 05:59:39 -0700 (PDT) Received: by wwi18 with SMTP id 18so432829wwi.2 for ; Sat, 16 Apr 2011 05:59:38 -0700 (PDT) Received: by 10.227.61.146 with SMTP id t18mr2981489wbh.189.1302958777837; Sat, 16 Apr 2011 05:59:37 -0700 (PDT) Received: from localhost (99.28-240-81.adsl-dyn.isp.belgacom.be [81.240.28.99]) by mx.google.com with ESMTPS id bd8sm2157860wbb.48.2011.04.16.05.59.35 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 16 Apr 2011 05:59:36 -0700 (PDT) From: Pieter Praet To: Florian Friesdorf , notmuch@notmuchmail.org Subject: Re: Optimization for notmuch tag by implicit filters In-Reply-To: <87y63d6y25.fsf@eve.chaoflow.net> References: <87y63d6y25.fsf@eve.chaoflow.net> User-Agent: Notmuch/0.5-86-g4875299 (http://notmuchmail.org) Emacs/23.1.50.1 (x86_64-pc-linux-gnu) Date: Sat, 16 Apr 2011 14:59:34 +0200 Message-ID: <87mxjqgxmx.fsf@A7GMS.i-did-not-set--mail-host-address--so-tickle-me> 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: Sat, 16 Apr 2011 12:59:41 -0000 On Thu, 14 Apr 2011 10:23:46 +0200, Florian Friesdorf wrote: > > With 60k messages and 12k tagged as sent: > > $ time notmuch tag +sent -- from:flo@chaoflow.net > > real 0m8.561s > user 0m8.069s > sys 0m0.212s > > $ time notmuch tag +sent -- from:flo@chaoflow.net and not tag:sent > > real 0m0.043s > user 0m0.036s > sys 0m0.006s > > > This could be made implicit: > > notmuch tag +A +B -- > --> > notmuch tag +A +B -- and not \(tag:A and tag:B\) > > Apply command, if one of the tags is not set. > > > notmuch tag -C -D -- > --> > notmuch tag -C -D -- and \(tag:C or tag:D\) > > Apply command, if one of the tags is set. > > > notmuch tag +A +B -C -D -- > --> > notmuch tag +A +B -C -D -- and \(not tag:A or not tag:B\ or tag:C or tag:D\) > > > In order to enforce tagging and disable the filter there could be a > flag. > > I lack the knowledge/time to implement it, but I think it's at least > worth documenting it. > > -- > Florian Friesdorf > GPG FPR: 7A13 5EEE 1421 9FC2 108D BAAF 38F8 99A3 0C45 F083 > Jabber/XMPP: flo@chaoflow.net > IRC: chaoflow on freenode,ircnet,blafasel,OFTC Non-text part: application/pgp-signature > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch Most of us already do this explicitly in our tagging scripts, so no harm in making it standard behaviour, I guess. Though to keep the implementation nice & clean, I'd advise against the use of parens: no need for escape chars, no messing with De Morgan's law, simply map the tag operations to their inverse in conjunctively joined filters: notmuch tag +A +B -- and not tag:A or not tag:B notmuch tag -C -D -- and tag:C or tag:D notmuch tag +A +B -C -D -- and not tag:A or not tag:B or tag:C or tag:D Peace -Pieter