For a long time Gmail filters were keeping my inbox clean by automatically archiving all emails incoming from mailing lists. Even if it looks efficient, there's actually a big issue. Do you seriously take time to read all these unread archived emails?
If you already missed an important vulnerability report or answered to a two-year old unanswered question on a mailing list, take a seat.
Back in the days when I started to use Mutt, I also started to auto-archive mailing lists for two reasons:
- Some mailing lists keeps the original subject which provides no way to easily read the name in the index view of Mutt
- And I lost the color of my Gmail labels
Few weeks ago I started looking for a way to remove this auto-archive and still keep a readable inbox.
The first thing was to always have the mailing list name on the index view.
%L while reading some Mutt documentation. Used in
%L will print the list-name if an address defined in
subscribe if found in the
So, basically I listed all mailing lists to which I am subscribed like this in
subscribe firstname.lastname@example.org email@example.com firstname.lastname@example.org subscribe email@example.com subscribe firstname.lastname@example.org subscribe email@example.com # And so on…
The downside of this feature is that it will print the maildir folder if no subscribed address is found:
If an address in the To or CC header field matches an address defined by the users ``subscribe'' command, this displays "To <list-name>", otherwise the same as %F.
It's important to say here that I recently replaced Mutt with NeoMutt, a quite active fork which includes a lot of patches like the sidebar and notmuch support.
So… Let's do some hacking.
After few hours in some C files, I proposed a change to NeoMutt: add support of
%K is basically like
but it will remain empty if no subscribed address is found and it can be used
with a condition (
With this change we can have an
$index_format of the following form:
set index_format = "%4C (%4c) %Z %?GI?%GI& ? %[%d/%b] %-20.19F %?K?%15.14K& ? %?M?(%3M)& ? %?X?¤& ? %s %> %?g?%g?"
Which will create a dedicated column for the list name like in the following image:
In the previous example
%?K?%15.14K& ? instructs Mutt to:
%?K?%15.14K: print the first 14 characters of
%Kin a field limited to 15 characters if
%Kis not empty
& ?: print 15 whitespaces otherwise
Now that I have a textual equivalent to Gmail labels, there is one thing left: colors.
Let's do some really nasty things with
color index and patterns:
color index color73 default "~C firstname.lastname@example.org"
This line will use color73 as foreground color for all emails sent to the HAProxy mailing list.
We can even have a bold color for new emails from this mailing list:
color index brightcolor73 default "~N ~C email@example.com"
Here is an excerpt of my subscriptions configuration file for Mutt:
subscribe firstname.lastname@example.org email@example.com firstname.lastname@example.org color index color73 default "~C email@example.com | ~C firstname.lastname@example.org | ~C email@example.com" color index brightcolor73 default "~N (~C firstname.lastname@example.org | ~C email@example.com | ~C firstname.lastname@example.org)" subscribe email@example.com color index color42 default "~C firstname.lastname@example.org" color index brightcolor42 default "~N ~C email@example.com" subscribe firstname.lastname@example.org color index color30 default "~C email@example.com" color index brightcolor30 default "~N ~C firstname.lastname@example.org" subscribe email@example.com firstname.lastname@example.org color index color3 default "~C email@example.com | ~C firstname.lastname@example.org" color index brightcolor3 default "~N (~C email@example.com | ~C firstname.lastname@example.org)" subscribe email@example.com color index color10 default "~C firstname.lastname@example.org" color index brightcolor10 default "~N ~C email@example.com"
Yes, I'm using a dedicated color for each mailing list. The complete file gives me the following colored inbox:
Note: the support of
%K should land in the next release of NeoMutt. If you
want it now you should patch your installation using
For more information:
$index_formatin Mutt's documentation
$index_formatin NeoMutt's documentation
- Mailing Lists in Mutt's documentation
- Patterns in Mutt's documentation