A brief introduction to mutt-ng
Posted by Steve on Mon 14 May 2007 at 09:57
mutt is a well known and much loved mail client well suited to the efficient handling of a large volume of email. One of the things which makes it so powerful is its extreme flexibility and customisation options. The next-generation mutt package builds upon the core mutt with some additional features; most noticeably the introduction of a sidebar, which this article introduces.
To start with I'll explain how my current installation of mutt is configured. When the mail-client starts it reads and parses the per-user configuration file ~/.muttrc if present.
My current ~/.muttrc file consists of one line :
source ~/.mutt-`test -e ~/.mutt-$(hostname -s) && echo $(hostname -s) || echo global`
That looks pretty scary, but the result is pretty simple though:
- If the file ~/.mutt-HOSTNAME exists it is read and parsed.
- Where "HOSTNAME" is the short hostname of the current machine.
- Otherwise ~/.mutt-global is read and parsed.
This system allows me to store the configuration specific to a number of different hosts within a single CVS tree without having to worry about replacing ~/.muttrc with the correct one on each machine.
The configuration snippet above can be broken down into two parts: The directive "source" which instructs the system to include, and process, another file, and the shell command which is sandwiched between ` (backtick) characters. If you're familiar with shell scripting this should be pretty recognisable to you - if not then don't worry about it!
The reason for introducing this file is to demonstrate how we can conditionally configure mutt to process different files, which is something we'll need later.
Rather than jumping ahead further we'll install the package. For the Etch release of Debian GNU/Linux you'll need to update your sources.list for APT, as the package isn't included in the release proper.
Add the following to your /etc/apt/sources.list file:
# # "Experimental" for mutt-ng # deb http://ftp.uk.debian.org/debian/ experimental main non-free contrib deb-src http://ftp.uk.debian.org/debian/ experimental main non-free contrib
Once you've done that you may update your lists and install the package with your favourite package-manager. I use apt-get, you may use whatever you like:
vain:~# apt-get update && apt-get install mutt-ng
Once the mutt-ng package is installed you can test your current mutt setup with it. The package will load a different configuration file at startup, so you can either copy your ~/.muttrc file to ~/.muttngrc or create a symbolic link:
skx@vain:~$ ln -s ~/.muttrc ~/.muttngrc
Starting up muttng works just fine for me:
With this setup I can immediately see my messages:
(There might have been errors if some configuration options I'd been using were removed in this package; however that wasn't the case for me.)
To get started using the new features of muttng I'll create a new configuration file ~/.mutt-sidebar with the following contents:
# # Sidebar basics. # set sidebar_width=20 set sidebar_visible=no set sidebar_delim='|' # # color of folders with new mail # color sidebar_new red default # # ctrl-n, ctrl-p to navigate to the next/previous mailbox with unread mail. # ctrl-o to open the selected folder. # bind index \CP sidebar-prev-new bind index \CN sidebar-next-new bind pager \CP sidebar-prev-new bind pager \CN sidebar-next-new bind pager \CO sidebar-open bind index \CO sidebar-open # # Toggle sidebar visibility # macro index b '
toggle sidebar_visible ' macro pager b ' toggle sidebar_visible '
As I run mutt upon several systems which will only have the vanilla mutt package installed I must update my configuration file to load this new file conditionally. I can either cause the file to be loaded by adding "source ~/.mutt-sidebar" to ~/.mutt-vain, a host I have, or I can update ~/.muttrc with something like this:
# # Load the sidebar configuration file if this host has muttng # # If not just show the version number of mutt on startup - the best # side-effect free alternative I can think of! # `test -x /usr/bin/muttng && echo source .mutt-sidebar || echo "push
Either way we'll assume you've configured this appropriately.
Once you've started up your copy of mutt-ng after updating your configuration file you'll be able to press b to view the folder-browser. For me this looks something like this:
To move the cursor to the next/previous mailbox containing new mail I simply press Ctrl+n, or Ctrl+p. The currently selected folder may be opened, or visited, by pressing Ctrl+o.
It didn't take me very long to get used to this new facility, since finding mailboxes with new mail visually is very simple and navigating amongst them is straight-forward.
Finally I'll sum up by saying that the future of the mutt-ng project looks uncertain. The mutt-ng homepage still exists, but there has been little activity recently. Reassuringly the development blog avows the project is not dead, but it seems like things are unlikely to develop quickly at the moment.
All in all though the additional features added to mutt by the mutt-ng fork seem reasonable and it is to be hoped they'll be accepted into the mainline project in the future.