From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id DB7EA6DE31FA for ; Thu, 22 Jun 2017 17:01:04 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.423 X-Spam-Level: X-Spam-Status: No, score=-0.423 tagged_above=-999 required=5 tests=[AWL=-0.101, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.211, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Qz7MBFrmvXK9 for ; Thu, 22 Jun 2017 17:01:02 -0700 (PDT) Received: from mail-pf0-f177.google.com (mail-pf0-f177.google.com [209.85.192.177]) by arlo.cworth.org (Postfix) with ESMTPS id C8F6E6DE31E4 for ; Thu, 22 Jun 2017 17:01:02 -0700 (PDT) Received: by mail-pf0-f177.google.com with SMTP id c73so15745307pfk.2 for ; Thu, 22 Jun 2017 17:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=tOrfk8d5vGdwEp8jAU0HdxSkqJas4HbjJ5MRVn7EkK8=; b=XxgQNisqTPkd3cRXas9p13q5vUfwrsud3e9gTze1WnTkVp0TS0mlZDHIM3DlK30aX2 T+yk+sEt6Zv3VWn4UMp8ig6QaoM1Y4VcH/mIZYx7iACMSjNImJoeMLKFW+lPpPvj/Qgx GYGUa/p1KB0JKSmjpwturvsIMKHAL6maC7GSa/Ji5ueyXlmW1ZGx5j6RRrBurxBwiPEu tI1WogiMk32FrWXH7RLL+YY/jsF+LxhEIlGd7W2AwhG9/aTkjXPWmvY+DQzu1Rcv6/iL EBOUcsr6UCY1Sff2NyCG+Vp4b4T8WIC4+qSDz6OoBdW/e0tmWVYhBmieDDS0xWGdIP6B CUfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=tOrfk8d5vGdwEp8jAU0HdxSkqJas4HbjJ5MRVn7EkK8=; b=O1fw5atiLnSFkR0BTSE6iwwoCrI/6kiPTfEYqb2FZuLC67BhUgzQpei85r5dt1MIPc AKFg1SaznRixXwPxlMasgoSkFmQBpiMjGAVzZ1yZRc3k/wzfq9s4QP63DkRseVU9SB3d BbhdF27jP6ijPq9hRfqkuQh7QoNgfbKGYQT9ey7LbYZPcZfZYa5Jo1SqusyS5h0W93Bc Bu+mNzdvyaKpBwlir5a4deb8GgcYnsvGIQ54xfvOzxRVQNJjbXNaETUIVLDEBARw/PHC Q0E0bVsQpLzwRNDy87KThvgy4TRKGsIUM4i5Hxz8Nis+Hh584VnZXL85vG995WdAqOhU S5yw== X-Gm-Message-State: AKS2vOxKrSN/lui+Hf6vcuS4t8RSJJnkAoJv8w4JJAojMhlDyM5Hk7zj 6sMnufV/pmq5+pzR X-Received: by 10.98.201.25 with SMTP id k25mr5245972pfg.206.1498176060853; Thu, 22 Jun 2017 17:01:00 -0700 (PDT) Received: from marmstrong-linux.kir.corp.google.com ([2620:0:1008:11:c96e:1743:c20f:75c4]) by smtp.gmail.com with ESMTPSA id a79sm6245777pfj.5.2017.06.22.17.00.59 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 22 Jun 2017 17:00:59 -0700 (PDT) From: Matt Armstrong To: Gaute Hope , David Bremner , Daniel Kahn Gillmor , notmuch@notmuchmail.org, Xu Wang Subject: Re: find threads where I and Jian participated but not Dave In-Reply-To: <1498112439.apimm1pnum.astroid@strange.none> References: <87bmprtqgo.fsf@tethera.net> <87fuf1nnl5.fsf@fifthhorseman.net> <8737b1rojw.fsf@tethera.net> <1497594312.ahjx44w937.astroid@strange.none> <87r2ydgh9t.fsf@fifthhorseman.net> <1498111587.9x086zp6wn.astroid@strange.none> <1498112439.apimm1pnum.astroid@strange.none> Date: Thu, 22 Jun 2017 17:00:58 -0700 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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: Fri, 23 Jun 2017 00:01:05 -0000 Gaute Hope writes: > Gaute Hope writes on juni 22, 2017 8:08: >> Daniel Kahn Gillmor writes on juni 21, 2017 23:30: >>> On Wed 2017-06-21 13:04:53 -0700, Matt Armstrong wrote: >>>> For what it is worth, I've found this idea from Daniel intriguing and >>>> pretty useful in practice: >>>> >>>> "show me threads in which i've participated, where there are some >>>> messages flagged with 'inbox'" >>>> >>>> I implement it like this in my post-new hook: >>>> >>>> # All messages in threads in which I participate get tag:participated >>>> notmuch search --output=threads from:marmstrong | \ >>>> sed -e 's,^,+participated -- ,' | \ >>>> notmuch tag --batch >>> >>> cool, thx for the suggestion. >>> >>> the "notmuch search" part of the pipeline alone takes ~19s (wall time, >>> and actual CPU time) for me though :/ It returns 30504 threads! how >>> many threads do you get? >> >> Is there any reason why you do not filter on a tag 'new' as well? >> >> notmuch search --output=threads from:marmstrong and tag:new | \ >> sed -e 's,^,+participated -- ,' | \ >> notmuch tag --batch >> > > Nevermind, I get it - it might be possible to add a temporary tag > new-tag to the whole thread first and not just new messages. That might > be faster. As long as all sent messages get the new tag as well. Gaute, I took this as a challenge and came up with what I think is an equivalent but more efficient approach. The disadvantage is that it is much more complex. The advantage is that it runs in under 0.2 seconds to process a day's worth of my "new" mail. I now have this in my notmuch post-hook. I believe I could change the "tag:new OR date:today" query to just "tag:new". The "OR date:today" helped during interactive development. # All threads in which I participate get tag:participated # 1) Find all threads with a message tagged new # (finding all 'today' messages helps during testing, # but isn't necessary) # 2) Run through "xargs -s 2048 echo" to to group threads # lines of about 2K in size. # 3) For each line (2) produces, narrow the threads to # those containing a message from me. # 4) For each such thread, tag every message with +participated. notmuch search --output=threads tag:new OR date:today | \ xargs -s 2048 echo | \ xargs -I '{}' notmuch search \ --output=threads from:marmstrong AND \( '{}' \) | \ sed -e 's,^,+participated -- ,' | \ notmuch tag --batch The basic idea is that each run of the notmuch post-hook will incorporate relatively little mail, so the number of unique threads will be relatively small. So, we just list them all by thread ID. Then for each thread with new messages, we figure out which threads have a message from:marmstrong (it need not be the new message). We then tag all messages in each of those threads with +participated. You said "it might be possible to add a temporary tag new-tag to the whole thread first and not just new messages." -- Yes, and that is implicitly what I am doing, except that each such thread is instead tracked in an ephemeral way through the xargs based shell pipeline. I did try an approach of explicitly labeling all messages in "new" threads, temporarily, but that was slower. You said "As long as all sent messages get the new tag as well." -- true, and I'm not sure about that. My primary use for this is to discover new activity from others *after* I've participated in a thread, so I don't much care if a thread that is "participated in" is not tagged that way until some mail from somebody else arrives.