* how to work with entire threads
@ 2013-07-09 12:22 Vladimir Marek
2013-07-21 8:49 ` Mark Walters
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Marek @ 2013-07-09 12:22 UTC (permalink / raw)
To: notmuch
Hi,
I would like to create the following process:
1) if I tag any message with the keyword 'kill', it means that I don't
want to see any message from whole thread in my inbox
At the moment I do something like
THREADS=$(notmuch search --output=threads tag:kill)
[ -z "$THREADS" ] || notmuch tag -unread -- '(' $THREADS ')'
2) if there is such a 'killed' thread and it won't receive message for
30 days, I want to remove the kill tag from the thread
That I achieved by something like
N=notmuch
KILL=$( $N search --output=threads tag:kill )
if [ -n "$KILL" ]; then
# Then find threads which contain messages younger than 30 days
KILL_RECENT=$( $N search --output=threads '(' $KILL ')' and date:30days.. )
KILL_RECENT=${KILL_RECENT:-'*'}
# Then find 'kill' threads not matching those recent
KILL_COUNT=$( $N count --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' )
if [ $KILL_COUNT -gt 0 ]; then
echo "Threads to remove 'kill': $KILL"
$N tag -kill -- $( $N search --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' )
fi
fi
I was thinking if it could not be simplified. Without knowing anything about
notmuch or xapian internals, it seems that it would be handy to change the
search pattern to return threads. My two previous examples would then read like
1) notmuch tag -unread -- 'threads(tag:kill)'
and
2) notmuch tag -kill -- 'threads(tag:kill)' and not 'threads(date:30days..)'
Given that this would be possible in the first place, wouldn't it be a nice
addition to notmuch?
Thank you
--
Vlad
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: how to work with entire threads
2013-07-09 12:22 how to work with entire threads Vladimir Marek
@ 2013-07-21 8:49 ` Mark Walters
2013-07-21 13:00 ` Vladimir Marek
0 siblings, 1 reply; 3+ messages in thread
From: Mark Walters @ 2013-07-21 8:49 UTC (permalink / raw)
To: Vladimir Marek, notmuch
Hi
Vladimir Marek <Vladimir.Marek@Oracle.COM> writes:
> Hi,
>
> I would like to create the following process:
>
> 1) if I tag any message with the keyword 'kill', it means that I don't
> want to see any message from whole thread in my inbox
>
> At the moment I do something like
>
> THREADS=$(notmuch search --output=threads tag:kill)
> [ -z "$THREADS" ] || notmuch tag -unread -- '(' $THREADS ')'
>
> 2) if there is such a 'killed' thread and it won't receive message for
> 30 days, I want to remove the kill tag from the thread
>
> That I achieved by something like
>
> N=notmuch
> KILL=$( $N search --output=threads tag:kill )
> if [ -n "$KILL" ]; then
> # Then find threads which contain messages younger than 30 days
> KILL_RECENT=$( $N search --output=threads '(' $KILL ')' and date:30days.. )
> KILL_RECENT=${KILL_RECENT:-'*'}
> # Then find 'kill' threads not matching those recent
> KILL_COUNT=$( $N count --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' )
> if [ $KILL_COUNT -gt 0 ]; then
> echo "Threads to remove 'kill': $KILL"
> $N tag -kill -- $( $N search --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' )
> fi
> fi
>
>
>
> I was thinking if it could not be simplified. Without knowing anything about
> notmuch or xapian internals, it seems that it would be handy to change the
> search pattern to return threads. My two previous examples would then read like
>
> 1) notmuch tag -unread -- 'threads(tag:kill)'
> and
> 2) notmuch tag -kill -- 'threads(tag:kill)' and not 'threads(date:30days..)'
>
> Given that this would be possible in the first place, wouldn't it be a nice
> addition to notmuch?
Some form of general thread based search would definitely be a nice
addition. This seems to be non-trivial as we would need to parse the
query ourselves rather than leaving that to xapian.
However, I think thread bases tagging would be quite easy:
eg
notmuch tag --thread +/-tags <search-term>
to tag all messages in all threads that contain a message match the
search terms. Your first case would become notmuch tag --thread
-unread tag:kill but your second case would still not be directly
possible.
Would this be a useful addition by itself?
Best wishes
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: how to work with entire threads
2013-07-21 8:49 ` Mark Walters
@ 2013-07-21 13:00 ` Vladimir Marek
0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Marek @ 2013-07-21 13:00 UTC (permalink / raw)
To: Mark Walters; +Cc: notmuch
> > I would like to create the following process:
> >
> > 1) if I tag any message with the keyword 'kill', it means that I don't
> > want to see any message from whole thread in my inbox
> >
> > At the moment I do something like
> >
> > THREADS=$(notmuch search --output=threads tag:kill)
> > [ -z "$THREADS" ] || notmuch tag -unread -- '(' $THREADS ')'
> >
> > 2) if there is such a 'killed' thread and it won't receive message for
> > 30 days, I want to remove the kill tag from the thread
> >
> > That I achieved by something like
> >
> > N=notmuch
> > KILL=$( $N search --output=threads tag:kill )
> > if [ -n "$KILL" ]; then
> > # Then find threads which contain messages younger than 30 days
> > KILL_RECENT=$( $N search --output=threads '(' $KILL ')' and date:30days.. )
> > KILL_RECENT=${KILL_RECENT:-'*'}
> > # Then find 'kill' threads not matching those recent
> > KILL_COUNT=$( $N count --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' )
> > if [ $KILL_COUNT -gt 0 ]; then
> > echo "Threads to remove 'kill': $KILL"
> > $N tag -kill -- $( $N search --output=threads '(' $KILL ')' and not '(' $KILL_RECENT ')' )
> > fi
> > fi
> >
> >
> >
> > I was thinking if it could not be simplified. Without knowing anything about
> > notmuch or xapian internals, it seems that it would be handy to change the
> > search pattern to return threads. My two previous examples would then read like
> >
> > 1) notmuch tag -unread -- 'threads(tag:kill)'
> > and
> > 2) notmuch tag -kill -- 'threads(tag:kill)' and not 'threads(date:30days..)'
> >
> > Given that this would be possible in the first place, wouldn't it be a nice
> > addition to notmuch?
>
> Some form of general thread based search would definitely be a nice
> addition. This seems to be non-trivial as we would need to parse the
> query ourselves rather than leaving that to xapian.
>
> However, I think thread bases tagging would be quite easy:
>
> eg
>
> notmuch tag --thread +/-tags <search-term>
>
> to tag all messages in all threads that contain a message match the
> search terms. Your first case would become notmuch tag --thread
> -unread tag:kill but your second case would still not be directly
> possible.
>
> Would this be a useful addition by itself?
As you said, marking whole threads as read would be a case I would use
regularly. If anyone is willing to add that feature, I would be glad.
Even the second case would be possible, just not as elegant (but still
better than my shell construct)
notmuch tag --thread +kill -- tag:kill
notmuch tag -kill -- tag:kill and not date:30days..
Cheers
--
Vlad
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-21 13:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-09 12:22 how to work with entire threads Vladimir Marek
2013-07-21 8:49 ` Mark Walters
2013-07-21 13:00 ` Vladimir Marek
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).