[Tfug] Conditional sorting in Mutt?

Robert Hunter hunter at tfug.org
Wed Oct 4 05:48:35 MST 2006


> So, what I'd like to do is tell Mutt not to thread based upon the
> subject for a regexp of particular subjects.  One way to do this
> would
> be to, on opening an mbox folder, scan the subject headers and break
> the thread for any message that matches the regexp, and then resort
> the mailbox by it's default method.  But it's not clear to me that
> Mutt can act on individual messages within a folder-hook.  Does
> anyone
> know differently?  Or if there's a different way to accomplish the
> desired behavior?

You can disable "pseudo-threading" entirely by setting the
"strict_threads" variable.

http://www.mutt.org/doc/manual/manual-6.html#strict_threads

For subject-based threading, mutt looks for matching subjects,
optionally prefixed by a "reply" pattern.  The variables that control
this behavior are "sort_re" and "reply_regexp".  Unfortuantely, this
mechanism doesn't seem to be capable of doing what you want.

One hack would be to rewrite the subject with procmail in such a way
that will make mutt's "reply_rexegp" fail.  Something like the
following might work:

:0
# A reply
* ^Subject:.*Re:
# No message ID
* ! ^In-Reply-To:
{
  :0 fwh
  # remove "Re" if subject is generic
  | perl -pe 's/Re://g if /hi/ or /hey/ or /hello/'
}

HTH
-- 
Rob




More information about the tfug mailing list