On Thu, Oct 04, 2012 at 10:54:39AM +0200, M. Fioretti wrote:
> 
> On Thu, October 4, 2012 10:47 am, Alexis Letessier wrote:
> 
> > I use notmuch to index all my emails but i need some kind of database or
> > something to redirect threads that i already filtered out.
> > Is this a strange idea or should i change my workflow? Any ideas on how
> > this could be implemented?
> 
> I do the same thing with a custom procmail recipe explained here on my blog:
> 
> http://freesoftware.zona-m.net/how-ignore-uninteresting-threads-in-mailing-lists/

I use procmail and some shell scripts to basically do the same.  Here is
my .procmail rule:

# Process killed threads, save killed threads in killedthreads mbox
:0:
* ? $HOME/bin/isthreadkilled
killedthreads

To mark a thread/subthread for killing I use this with mutt:
macro pager \\k 
"<ESC>t;|killthread\n;<save-message>=killedthreads\n<delete-subthread>" "Kill 
this subthread"

I've attached both the isthreadkilled and killedthreads scripts.  Note,
these are run on Solaris and will need to be edited slightly to work on
other platforms.

-- 
Will Fiveash
#!/bin/ksh -p

# For use by procmail to kill mail threads, procmail will pipe mail message in 
via stdin.
# Will return 0 if the In-Reply-To: or References: ID is in the killedthreads 
file.

killthreadfile='/export/home/wfiveash/app_support/var/mail/killedthreads'

tmpfile=$(/usr/bin/mktemp -t iskilled.XXXXXX)
integer rc=1

# Copy message from stdin to tmpfile
cat > $tmpfile

if [[ -s $tmpfile ]]
then
        /usr/bin/formail -c -x In-Reply-To: < $tmpfile |\
                /usr/gnu/bin/grep -qsF -f $killthreadfile
        rc=$?
        if [[ $rc -ne 0 ]]
        then
                /usr/bin/formail -c -x References: < $tmpfile |\
                        /usr/gnu/bin/grep -qsF -f $killthreadfile
                rc=$?
        fi
fi

[[ $rc -eq 0 ]] && /usr/bin/formail -c -x Message-ID: < $tmpfile >> 
$killthreadfile

rm -f $tmpfile
exit $rc
#!/bin/ksh -p

killthreadfile='/export/home/wfiveash/app_support/var/mail/killedthreads'

# Will get the message-ID for multiple messages on stdin
formail -s 'formail -c -x Message-ID' | sed -e 's/^  */ /' >> $killthreadfile

Reply via email to