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 32306431FD0 for ; Wed, 27 Apr 2011 13:42:01 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 DZwgzAVVnfnY for ; Wed, 27 Apr 2011 13:42:00 -0700 (PDT) Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 3B42C431FB5 for ; Wed, 27 Apr 2011 13:42:00 -0700 (PDT) Received: by wyi11 with SMTP id 11so1719783wyi.26 for ; Wed, 27 Apr 2011 13:41:59 -0700 (PDT) Received: by 10.216.144.134 with SMTP id n6mr2652419wej.27.1303936918949; Wed, 27 Apr 2011 13:41:58 -0700 (PDT) Received: from localhost (202.69-240-81.adsl-dyn.isp.belgacom.be [81.240.69.202]) by mx.google.com with ESMTPS id g46sm553242wes.40.2011.04.27.13.41.56 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Apr 2011 13:41:58 -0700 (PDT) From: Pieter Praet To: Florian Friesdorf , notmuch@notmuchmail.org Subject: Re: Optimization for notmuch tag by implicit filters In-Reply-To: <87k4egu2ci.fsf@eve.chaoflow.net> References: <87y63d6y25.fsf@eve.chaoflow.net> <87mxjqgxmx.fsf@A7GMS.i-did-not-set--mail-host-address--so-tickle-me> <87k4egu2ci.fsf@eve.chaoflow.net> User-Agent: Notmuch/0.5-98-g63c37b1 (http://notmuchmail.org) Emacs/23.1.50.1 (x86_64-pc-linux-gnu) Date: Wed, 27 Apr 2011 22:41:56 +0200 Message-ID: <87mxjb8m0b.fsf@praet.org> 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: Wed, 27 Apr 2011 20:42:01 -0000 On Tue, 26 Apr 2011 23:31:09 +0200, Florian Friesdorf wrote: > On Sat, 16 Apr 2011 14:59:34 +0200, Pieter Praet wrote: > > 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\) > > The second '\' after 'B' is not supposed to be there. > > > > 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. > > > > 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 > > I am not sure whether I understand what you mean. > > The parens are already supported by notmuch and also needed. Your second > line for example would remove C and D, if D is set, independently of > . Without parens, based on `and` taking precedence over `or`: > > F and (C or D) = F and C or F and D. > > -- > 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 Correct. I wasn't taking the user-defined into consideration, which should indeed be conjunctive with the *entire* following expression. I was commenting on the use of parens *inside* our implicit filter, which was absolutely superfluous since you did no such thing. :D Also, I said "simply map the tag operations to their inverse in conjunctively joined filters", but what I meant was "DISjunctively joined filters". Perhaps I should go over my textbook on propositional logic again one of these days :) Peace -Pieter