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 2268E431FB6 for ; Wed, 24 Nov 2010 13:21:22 -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 VWY-JmKuUJlS for ; Wed, 24 Nov 2010 13:21:19 -0800 (PST) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id C0995431FB5 for ; Wed, 24 Nov 2010 13:21:19 -0800 (PST) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id 7EE1019F3335; Wed, 24 Nov 2010 22:21:18 +0100 (CET) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id AKSed3REeU3q; Wed, 24 Nov 2010 22:21:17 +0100 (CET) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id 453A319F3337; Wed, 24 Nov 2010 22:21:17 +0100 (CET) Received: from steelpick.2x.cz (unknown [213.29.198.144]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id 3737FFA005; Wed, 24 Nov 2010 22:21:17 +0100 (CET) Received: from wsh by steelpick.2x.cz with local (Exim 4.72) (envelope-from ) id 1PLMmC-0007KU-Ka; Wed, 24 Nov 2010 22:21:16 +0100 From: Michal Sojka To: Sebastian Spaeth , Notmuch developer list Subject: Re: hint: ignoring threads In-Reply-To: <87lj4kavpa.fsf@SSpaeth.de> References: <87lj4kavpa.fsf@SSpaeth.de> User-Agent: Notmuch/0.5-11-g48b5e00 (http://notmuchmail.org) Emacs/23.2.1 (x86_64-pc-linux-gnu) Date: Wed, 24 Nov 2010 22:21:16 +0100 Message-ID: <87sjyqbepf.fsf@steelpick.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: Wed, 24 Nov 2010 21:21:22 -0000 On Tue, 23 Nov 2010, Sebastian Spaeth wrote: > I like to ignore annoying threads, but notmuch has not easy way to > achieve it, right? Well, it actually has... > > 1) ok, in notmuch-show I read a message, decide the thread is uninteresting > (or annoying) and tag that message as "ignore". > > 2) Adding "and not tag:ignore in my saved searches doesn't help as there > are still messages without tag ignore, so notmuch search will still show > the threads. So I run this now after notmuch new: TADAA... > > notmuch tag +ignore -- not tag:ignore and `notmuch search > --output=threads tag:ignore` You should use xargs to not reach the limit of the command line length. Something like (not tested): notmuch search --output=threads tag:ignore | xargs notmuch tag +ignore -- not tag:ignore and > It seems to work, afterwords all messages in a thread where at least one > message was tagges "ignore" will be tagged "ignore" and my saved > searches suppress them. > > Just wanted to share this tidbit as I can imagine plenty of usecases > where a similar scheme could be handy. In my view, this approach has a small disadvantage: the more threads that are tagged as "ignore" the longer time is needed to search for them. Since I want my initial tagging script to be as fast as possible I use a little bit different approach. My actual implementation is more complicated than I show here, but it can be simplified as follows: ignored_threads=$(notmuch search tag:new|grep ignore|cut -f 1 -d ' ') notmuch tag -new $ignored_threads I only search the new messages and use grep to match threads where at least one message is tagged as "ignore" (the regexp must be more complex to match only the tag part of the search output). Finally, I untag the ignored threads so that they do not appear in inbox (the last command of my tagging script is notmuch tag -new +inbox tag:new). It would be easier to write such script if we have notmuch search --output=thread-tags, which would print only tag part of the standard notmuch search output. -Michal