Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / ce / 5bb50664b211ea0d18570c9cd178a884d5b3ca
1 Return-Path: <Vladimir.Marek@Oracle.COM>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id ED132431FAF\r
6         for <notmuch@notmuchmail.org>; Tue,  9 Jul 2013 05:22:18 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.299\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.299 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3, UNPARSEABLE_RELAY=0.001]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id gbIsk59iIex3 for <notmuch@notmuchmail.org>;\r
17         Tue,  9 Jul 2013 05:22:11 -0700 (PDT)\r
18 Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 651B3431FAE\r
22         for <notmuch@notmuchmail.org>; Tue,  9 Jul 2013 05:22:11 -0700 (PDT)\r
23 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238])\r
24         by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with\r
25         ESMTP id r69CMAPF030370\r
26         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)\r
27         for <notmuch@notmuchmail.org>; Tue, 9 Jul 2013 12:22:10 GMT\r
28 Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230])\r
29         by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id\r
30         r69CM6h7018595\r
31         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)\r
32         for <notmuch@notmuchmail.org>; Tue, 9 Jul 2013 12:22:10 GMT\r
33 Received: from abhmt111.oracle.com (abhmt111.oracle.com [141.146.116.63])\r
34         by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id\r
35         r69CM6op015715\r
36         for <notmuch@notmuchmail.org>; Tue, 9 Jul 2013 12:22:06 GMT\r
37 Received: from virt.cz.oracle.com (/10.163.102.127)\r
38         by default (Oracle Beehive Gateway v4.0)\r
39         with ESMTP ; Tue, 09 Jul 2013 05:22:06 -0700\r
40 Date: Tue, 9 Jul 2013 14:22:00 +0200\r
41 From: Vladimir Marek <Vladimir.Marek@Oracle.COM>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: how to work with entire threads\r
44 Message-ID: <20130709122200.GA11501@virt.cz.oracle.com>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=utf-8\r
47 Content-Disposition: inline\r
48 User-Agent: Mutt/ (2012-12-30)\r
49 X-Source-IP: acsinet22.oracle.com [141.146.126.238]\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Tue, 09 Jul 2013 12:22:19 -0000\r
63 \r
64 Hi,\r
65 \r
66 I would like to create the following process:\r
67 \r
68  1) if I tag any message with the keyword 'kill', it means that I don't\r
69    want to see any message from whole thread in my inbox\r
70 \r
71 At the moment I do something like\r
72 \r
73 THREADS=$(notmuch search --output=threads tag:kill)\r
74 [ -z "$THREADS" ] || notmuch tag -unread -- '(' $THREADS ')'\r
75 \r
76  2) if there is such a 'killed' thread and it won't receive message for\r
77 30 days, I want to remove the kill tag from the thread\r
78 \r
79 That I achieved by something like\r
80 \r
81 N=notmuch\r
82 KILL=$( $N search --output=threads tag:kill )                                                                                                                                                          \r
83 if [ -n "$KILL" ]; then\r
84    # Then find threads which contain messages younger than 30 days\r
85    KILL_RECENT=$( $N search --output=threads '(' $KILL ')' and date:30days.. )\r
86    KILL_RECENT=${KILL_RECENT:-'*'}\r
87    # Then find 'kill' threads not matching those recent\r
88    KILL_COUNT=$( $N count --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' )\r
89    if [ $KILL_COUNT -gt 0 ]; then\r
90       echo "Threads to remove 'kill': $KILL"\r
91       $N tag -kill -- $( $N search --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' )\r
92    fi\r
93 fi\r
94 \r
95 \r
96 \r
97 I was thinking if it could not be simplified. Without knowing anything about\r
98 notmuch or xapian internals, it seems that it would be handy to change the\r
99 search pattern to return threads. My two previous examples would then read like\r
100 \r
101 1) notmuch tag -unread -- 'threads(tag:kill)'\r
102 and\r
103 2) notmuch tag -kill -- 'threads(tag:kill)' and not 'threads(date:30days..)'\r
104 \r
105 Given that this would be possible in the first place, wouldn't it be a nice\r
106 addition to notmuch?\r
107 \r
108 Thank you\r
109 -- \r
110         Vlad\r