Re: notmuch.el: controlling what does and doesn't get expanded in searches
[notmuch-archives.git] / 26 / 4a0f9c528290f7e13c7e897304161922f9a9a0
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 39649431FBF\r
6         for <notmuch@notmuchmail.org>; Sun, 21 Jul 2013 06:00:30 -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 V0r2P7p3QeqM for <notmuch@notmuchmail.org>;\r
17         Sun, 21 Jul 2013 06:00:22 -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 10AA9431FB6\r
22         for <notmuch@notmuchmail.org>; Sun, 21 Jul 2013 06:00:22 -0700 (PDT)\r
23 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94])\r
24         by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with\r
25         ESMTP id r6LD0Hgu013243\r
26         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);\r
27         Sun, 21 Jul 2013 13:00:19 GMT\r
28 Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231])\r
29         by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id\r
30         r6LD0FFZ000781\r
31         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);\r
32         Sun, 21 Jul 2013 13:00:16 GMT\r
33 Received: from abhmt119.oracle.com (abhmt119.oracle.com [141.146.116.71])\r
34         by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id\r
35         r6LD0FFr016485; Sun, 21 Jul 2013 13:00:15 GMT\r
36 Received: from virt.cz.oracle.com (/10.163.102.127)\r
37         by default (Oracle Beehive Gateway v4.0)\r
38         with ESMTP ; Sun, 21 Jul 2013 06:00:14 -0700\r
39 Date: Sun, 21 Jul 2013 15:00:10 +0200\r
40 From: Vladimir Marek <Vladimir.Marek@Oracle.COM>\r
41 To: Mark Walters <markwalters1009@gmail.com>\r
42 Subject: Re: Re: how to work with entire threads\r
43 Message-ID: <20130721130010.GA4405@virt.cz.oracle.com>\r
44 References: <20130709122200.GA11501@virt.cz.oracle.com>\r
45         <87bo5w8fhc.fsf@qmul.ac.uk>\r
46 MIME-Version: 1.0\r
47 Content-Type: text/plain; charset=utf-8\r
48 Content-Disposition: inline\r
49 In-Reply-To: <87bo5w8fhc.fsf@qmul.ac.uk>\r
50 User-Agent: Mutt/ (2012-12-30)\r
51 X-Source-IP: ucsinet22.oracle.com [156.151.31.94]\r
52 Cc: notmuch@notmuchmail.org\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Sun, 21 Jul 2013 13:00:30 -0000\r
66 \r
67 > > I would like to create the following process:\r
68 > >\r
69 > >  1) if I tag any message with the keyword 'kill', it means that I don't\r
70 > >    want to see any message from whole thread in my inbox\r
71 > >\r
72 > > At the moment I do something like\r
73 > >\r
74 > > THREADS=$(notmuch search --output=threads tag:kill)\r
75 > > [ -z "$THREADS" ] || notmuch tag -unread -- '(' $THREADS ')'\r
76 > >\r
77 > >  2) if there is such a 'killed' thread and it won't receive message for\r
78 > > 30 days, I want to remove the kill tag from the thread\r
79 > >\r
80 > > That I achieved by something like\r
81 > >\r
82 > > N=notmuch\r
83 > > KILL=$( $N search --output=threads tag:kill )                                                                                                                                                          \r
84 > > if [ -n "$KILL" ]; then\r
85 > >    # Then find threads which contain messages younger than 30 days\r
86 > >    KILL_RECENT=$( $N search --output=threads '(' $KILL ')' and date:30days.. )\r
87 > >    KILL_RECENT=${KILL_RECENT:-'*'}\r
88 > >    # Then find 'kill' threads not matching those recent\r
89 > >    KILL_COUNT=$( $N count --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' )\r
90 > >    if [ $KILL_COUNT -gt 0 ]; then\r
91 > >       echo "Threads to remove 'kill': $KILL"\r
92 > >       $N tag -kill -- $( $N search --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' )\r
93 > >    fi\r
94 > > fi\r
95 > >\r
96 > >\r
97 > >\r
98 > > I was thinking if it could not be simplified. Without knowing anything about\r
99 > > notmuch or xapian internals, it seems that it would be handy to change the\r
100 > > search pattern to return threads. My two previous examples would then read like\r
101 > >\r
102 > > 1) notmuch tag -unread -- 'threads(tag:kill)'\r
103 > > and\r
104 > > 2) notmuch tag -kill -- 'threads(tag:kill)' and not 'threads(date:30days..)'\r
105 > >\r
106 > > Given that this would be possible in the first place, wouldn't it be a nice\r
107 > > addition to notmuch?\r
108\r
109 > Some form of general thread based search would definitely be a nice\r
110 > addition. This seems to be non-trivial as we would need to parse the\r
111 > query ourselves rather than leaving that to xapian.\r
112\r
113 > However, I think thread bases tagging would be quite easy:\r
114\r
115 > eg\r
116\r
117 > notmuch tag --thread +/-tags <search-term>\r
118\r
119 > to tag all messages in all threads that contain a message match the\r
120 > search terms. Your first case would become notmuch tag --thread\r
121 > -unread tag:kill but your second case would still not be directly\r
122 > possible.\r
123\r
124 > Would this be a useful addition by itself?\r
125 \r
126 \r
127 As you said, marking whole threads as read would be a case I would use\r
128 regularly. If anyone is willing to add that feature, I would be glad.\r
129 \r
130 Even the second case would be possible, just not as elegant (but still\r
131 better than my shell construct)\r
132 \r
133 notmuch tag --thread +kill -- tag:kill\r
134 notmuch tag -kill -- tag:kill and not date:30days..\r
135 \r
136 Cheers\r
137 -- \r
138         Vlad\r