unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* 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

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).