Limiting folder view to an arbitrary set of mails in mutt

Aristotle on 2007-08-06T10:19:59

This is a neat and very simple use of features I just discovered in mutt.

By way of explanation (skip this if you know mutt well):

In mutt, there is a general notion of search patterns with a large variety of criteria; eg. the pattern “~d >10d” will match mails whose date is more than 10 days in the past. You can use such patterns to search for mail, of course, but they’re also used for many other commands, eg. “delete-pattern” and “tag-pattern”.

“Tagging” a message is mutt’s concept of selecting it for some subsequent batch operation; f.ex., you can reply to several mails in a single message by tagging them and then doing “tag-reply”. You can tag mails individually by hitting “t”, en masse using “tag-pattern” (which is cumulative; it does not untag mails), or even tag the entire thread a mail belongs to.

Another command that uses search patterns is “limit”, which reduces the list of messages shown in a folder to a particular subset. Said subset is selected by a search pattern – that way you can limit the view to mails with a particular subject, or from a particular date, or the like.

Now here’s the punchline:

The “limit” command can only select mails based on a pattern. Say you have several short threads from coworkers in your inbox, pertaining to the same issue. And you are like me and don’t cope well with clutter, so you want every other mail out of your view. But trying to come up with a pattern for "`limit`" that matches all the mails about that issue while matching no other message would be cumbersome.

There’s an easy solution: the search pattern “~T” matches all tagged messages! So just tag the messages you’re interested in, then limit your view to the tagged mails. (Note that you can untag the messages after limiting the view; the search expression is only evaluated once.)

This is very very simple, but just proved tremendously useful. I managed to process a suddenly overflowing inbox with much less mental effort than it would otherwise have taken. I can already tell I’ll be using this feature combination all the time now that I thought of it.