From: Vladimir Marek Date: Sun, 21 Jul 2013 13:00:10 +0000 (+0200) Subject: Re: Re: how to work with entire threads X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b07e1834d360b94d085d3be81ea61858b86a1cf8;p=notmuch-archives.git Re: Re: how to work with entire threads --- diff --git a/26/4a0f9c528290f7e13c7e897304161922f9a9a0 b/26/4a0f9c528290f7e13c7e897304161922f9a9a0 new file mode 100644 index 000000000..b41f7fe90 --- /dev/null +++ b/26/4a0f9c528290f7e13c7e897304161922f9a9a0 @@ -0,0 +1,138 @@ +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 39649431FBF + for ; Sun, 21 Jul 2013 06:00:30 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -2.299 +X-Spam-Level: +X-Spam-Status: No, score=-2.299 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_MED=-2.3, UNPARSEABLE_RELAY=0.001] + 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 V0r2P7p3QeqM for ; + Sun, 21 Jul 2013 06:00:22 -0700 (PDT) +Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 10AA9431FB6 + for ; Sun, 21 Jul 2013 06:00:22 -0700 (PDT) +Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) + by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with + ESMTP id r6LD0Hgu013243 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); + Sun, 21 Jul 2013 13:00:19 GMT +Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) + by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id + r6LD0FFZ000781 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); + Sun, 21 Jul 2013 13:00:16 GMT +Received: from abhmt119.oracle.com (abhmt119.oracle.com [141.146.116.71]) + by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id + r6LD0FFr016485; Sun, 21 Jul 2013 13:00:15 GMT +Received: from virt.cz.oracle.com (/10.163.102.127) + by default (Oracle Beehive Gateway v4.0) + with ESMTP ; Sun, 21 Jul 2013 06:00:14 -0700 +Date: Sun, 21 Jul 2013 15:00:10 +0200 +From: Vladimir Marek +To: Mark Walters +Subject: Re: Re: how to work with entire threads +Message-ID: <20130721130010.GA4405@virt.cz.oracle.com> +References: <20130709122200.GA11501@virt.cz.oracle.com> + <87bo5w8fhc.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +In-Reply-To: <87bo5w8fhc.fsf@qmul.ac.uk> +User-Agent: Mutt/ (2012-12-30) +X-Source-IP: ucsinet22.oracle.com [156.151.31.94] +Cc: notmuch@notmuchmail.org +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, 21 Jul 2013 13:00:30 -0000 + +> > I would like to create the following process: +> > +> > 1) if I tag any message with the keyword 'kill', it means that I don't +> > want to see any message from whole thread in my inbox +> > +> > At the moment I do something like +> > +> > THREADS=$(notmuch search --output=threads tag:kill) +> > [ -z "$THREADS" ] || notmuch tag -unread -- '(' $THREADS ')' +> > +> > 2) if there is such a 'killed' thread and it won't receive message for +> > 30 days, I want to remove the kill tag from the thread +> > +> > That I achieved by something like +> > +> > N=notmuch +> > KILL=$( $N search --output=threads tag:kill ) +> > if [ -n "$KILL" ]; then +> > # Then find threads which contain messages younger than 30 days +> > KILL_RECENT=$( $N search --output=threads '(' $KILL ')' and date:30days.. ) +> > KILL_RECENT=${KILL_RECENT:-'*'} +> > # Then find 'kill' threads not matching those recent +> > KILL_COUNT=$( $N count --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' ) +> > if [ $KILL_COUNT -gt 0 ]; then +> > echo "Threads to remove 'kill': $KILL" +> > $N tag -kill -- $( $N search --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' ) +> > fi +> > fi +> > +> > +> > +> > I was thinking if it could not be simplified. Without knowing anything about +> > notmuch or xapian internals, it seems that it would be handy to change the +> > search pattern to return threads. My two previous examples would then read like +> > +> > 1) notmuch tag -unread -- 'threads(tag:kill)' +> > and +> > 2) notmuch tag -kill -- 'threads(tag:kill)' and not 'threads(date:30days..)' +> > +> > Given that this would be possible in the first place, wouldn't it be a nice +> > addition to notmuch? +> +> Some form of general thread based search would definitely be a nice +> addition. This seems to be non-trivial as we would need to parse the +> query ourselves rather than leaving that to xapian. +> +> However, I think thread bases tagging would be quite easy: +> +> eg +> +> notmuch tag --thread +/-tags +> +> to tag all messages in all threads that contain a message match the +> search terms. Your first case would become notmuch tag --thread +> -unread tag:kill but your second case would still not be directly +> possible. +> +> Would this be a useful addition by itself? + + +As you said, marking whole threads as read would be a case I would use +regularly. If anyone is willing to add that feature, I would be glad. + +Even the second case would be possible, just not as elegant (but still +better than my shell construct) + +notmuch tag --thread +kill -- tag:kill +notmuch tag -kill -- tag:kill and not date:30days.. + +Cheers +-- + Vlad