How to Mute Threads in Mutt as in Gmail

Anyone who's on high-volume mailing lists knows this problem: some threads are irrelevant for you, but grow by tens or hundreds of mails each day. Incrementally archiving them in mutt is quick, but tedious. Google's Gmail has a mute feature for these threads. mutt did not, so I wrote a patch.

I use mutt since a little over a decade. I like how it's fast, modular, and customizable. What I still loathe are these quickly growing discussions on some lists (Boost review gauntlet comes to mind) that make it hard to maintain a tidy inbox: if the thread is irrelevant for me, then I either have to regularly archive/delete larger batches of mails or live with a flooded inbox. Neither of which is desirable.

In a recent discussion about mutt on Theodore Ts'o's G+ page, Adrian Knoth mentioned how Gmail allows you to zap these threads by marking them once and having all follow-ups archived automatically. mutt doesn't have such a functionality built-in, despite users asking for it. So, which options do we have?

  1. Suffer.
  2. Switch to GMail.
  3. Use this behemoth (which I didn't like for its side effects).
  4. Fix it.

The Patch

I was curious and went for option #4. The patch is actually quite simple: it adds a new function mutt_tag_muted_threads() which will iterate through the current mailbox and compare the references of each mail with the message IDs in a reference mailbox of to-be-muted threads. Each matching mail will be tagged. You're then free to delete or save the messages. A reference mailbox can be configured through the configuration variable muted, for instance my .muttrc contains the following line: set muted = $HOME/Mail/muted. This function is accessible through the new command tag-muted-threads, which is bound by default to the key »A« in index mode.

You can download the patch below. Installation should be fairly trivial as compiling mutt by hand isn't too difficult. Or, if you're running Gentoo, as you should, then you could just place the patch in /etc/portage/patches/mail-client/mutt/ and remerge the package. portage will then automatically apply the patch.

mutt-1.5.24-mute-threads-a-la-gmail.patch »

Usage

If you see a thread that you'd like to ignore/mute, just save it's root message to the muted mailbox. Press »A« to tag all mails in the current mailbox which reference at least one mail in the muted mailbox. Save/delete all tagged message as you always would with mutt: »;s«. This also works with branches of a thread, which is handy if you'd only like to ignore a certain subset which is veering off topic.