how to work with entire threads
authorVladimir Marek <Vladimir.Marek@Oracle.COM>
Tue, 9 Jul 2013 12:22:00 +0000 (14:22 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:55:56 +0000 (09:55 -0800)
ce/5bb50664b211ea0d18570c9cd178a884d5b3ca [new file with mode: 0644]

diff --git a/ce/5bb50664b211ea0d18570c9cd178a884d5b3ca b/ce/5bb50664b211ea0d18570c9cd178a884d5b3ca
new file mode 100644 (file)
index 0000000..033353a
--- /dev/null
@@ -0,0 +1,110 @@
+Return-Path: <Vladimir.Marek@Oracle.COM>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id ED132431FAF\r
+       for <notmuch@notmuchmail.org>; Tue,  9 Jul 2013 05:22:18 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.299\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.299 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3, UNPARSEABLE_RELAY=0.001]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id gbIsk59iIex3 for <notmuch@notmuchmail.org>;\r
+       Tue,  9 Jul 2013 05:22:11 -0700 (PDT)\r
+Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 651B3431FAE\r
+       for <notmuch@notmuchmail.org>; Tue,  9 Jul 2013 05:22:11 -0700 (PDT)\r
+Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238])\r
+       by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with\r
+       ESMTP id r69CMAPF030370\r
+       (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)\r
+       for <notmuch@notmuchmail.org>; Tue, 9 Jul 2013 12:22:10 GMT\r
+Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230])\r
+       by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id\r
+       r69CM6h7018595\r
+       (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)\r
+       for <notmuch@notmuchmail.org>; Tue, 9 Jul 2013 12:22:10 GMT\r
+Received: from abhmt111.oracle.com (abhmt111.oracle.com [141.146.116.63])\r
+       by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id\r
+       r69CM6op015715\r
+       for <notmuch@notmuchmail.org>; Tue, 9 Jul 2013 12:22:06 GMT\r
+Received: from virt.cz.oracle.com (/10.163.102.127)\r
+       by default (Oracle Beehive Gateway v4.0)\r
+       with ESMTP ; Tue, 09 Jul 2013 05:22:06 -0700\r
+Date: Tue, 9 Jul 2013 14:22:00 +0200\r
+From: Vladimir Marek <Vladimir.Marek@Oracle.COM>\r
+To: notmuch@notmuchmail.org\r
+Subject: how to work with entire threads\r
+Message-ID: <20130709122200.GA11501@virt.cz.oracle.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Disposition: inline\r
+User-Agent: Mutt/ (2012-12-30)\r
+X-Source-IP: acsinet22.oracle.com [141.146.126.238]\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 09 Jul 2013 12:22:19 -0000\r
+\r
+Hi,\r
+\r
+I would like to create the following process:\r
+\r
+ 1) if I tag any message with the keyword 'kill', it means that I don't\r
+   want to see any message from whole thread in my inbox\r
+\r
+At the moment I do something like\r
+\r
+THREADS=$(notmuch search --output=threads tag:kill)\r
+[ -z "$THREADS" ] || notmuch tag -unread -- '(' $THREADS ')'\r
+\r
+ 2) if there is such a 'killed' thread and it won't receive message for\r
+30 days, I want to remove the kill tag from the thread\r
+\r
+That I achieved by something like\r
+\r
+N=notmuch\r
+KILL=$( $N search --output=threads tag:kill )                                                                                                                                                          \r
+if [ -n "$KILL" ]; then\r
+   # Then find threads which contain messages younger than 30 days\r
+   KILL_RECENT=$( $N search --output=threads '(' $KILL ')' and date:30days.. )\r
+   KILL_RECENT=${KILL_RECENT:-'*'}\r
+   # Then find 'kill' threads not matching those recent\r
+   KILL_COUNT=$( $N count --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' )\r
+   if [ $KILL_COUNT -gt 0 ]; then\r
+      echo "Threads to remove 'kill': $KILL"\r
+      $N tag -kill -- $( $N search --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' )\r
+   fi\r
+fi\r
+\r
+\r
+\r
+I was thinking if it could not be simplified. Without knowing anything about\r
+notmuch or xapian internals, it seems that it would be handy to change the\r
+search pattern to return threads. My two previous examples would then read like\r
+\r
+1) notmuch tag -unread -- 'threads(tag:kill)'\r
+and\r
+2) notmuch tag -kill -- 'threads(tag:kill)' and not 'threads(date:30days..)'\r
+\r
+Given that this would be possible in the first place, wouldn't it be a nice\r
+addition to notmuch?\r
+\r
+Thank you\r
+-- \r
+       Vlad\r