unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Vladimir Marek <Vladimir.Marek@Oracle.COM>
To: notmuch@notmuchmail.org
Subject: how to work with entire threads
Date: Tue, 9 Jul 2013 14:22:00 +0200	[thread overview]
Message-ID: <20130709122200.GA11501@virt.cz.oracle.com> (raw)

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

             reply	other threads:[~2013-07-09 12:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-09 12:22 Vladimir Marek [this message]
2013-07-21  8:49 ` how to work with entire threads Mark Walters
2013-07-21 13:00   ` Vladimir Marek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130709122200.GA11501@virt.cz.oracle.com \
    --to=vladimir.marek@oracle.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).