Jiff Slater
🤔 About
✍️ Contact
28 Jul 2021

Setting up Mutt
12 July 2008

Mutt is an extremely fast and flexible text-based mail user agent with local maildir, POP3, and IMAP support.  It is my default mail client by choice.  Today, I will show you my Mutt configuration; perhaps it’ll help you to setup Mutt as well.

The diagram to the left (created with $latex Xy-pic$) shows my ~/.mutt hierarchy.  I’ll explain what each file/directory contains and then I’ll concatenate my the main configuration file, ~/.mutt/muttrc.

~/.mutt/aliases.rc – contains a list of my contacts in the format:

alias shortname Firstname Lastname email@address.com

~/.mutt/cache/ – contains a cache my mail headers for faster access

~/.mutt/gpg.rc – contains the commands for use with pgp/gpg encryption

~/.mutt/lists.rc – contains the subscribe command for each mailing-list I am subscribed to.  The subscribe command makes Mutt behave differently when reading mailing-lists (changes the default reply-to to the mailing list).

~/.mutt/muttrc – the main configuration file.  It is heavily commented below for your convenience.

~/.mutt/muttrc.local{1,2,3} – supplemental configuration files used for when I switch email accounts.

~ %  cat ~/.mutt/muttrc

set realname="Antony Jepson"    # My real name.
set sendmail="/usr/bin/msmtp"   # Sends the mail.
set edit_headers=no             # Can I edit headers of a message?
set index_format="%4C %Z %d %-15.15L (%-5c) %s" # Specify the index format.
# %4C - index number
# %Z - status flags
# %-15.15F - left justify the From: with a max of 15 characters
# %c - number of characters in the message
# %s - subject line

set date_format="%F"
set wait_key=no                 # Don't wait after using external programs.
set editor="vim + -c 'setlocal tw=72'" # Use vim as my default editor.
set signature="~/.signature"    # Set the default signature file.
set alias_file=~/.mutt/aliases.rc  # Store aliases here.
source ~/.mutt/aliases.rc       # Source the aliases file.
source ~/.mutt/lists.rc         # Source the mailing-lists file.
source ~/.mutt/macros.rc        # Source the macros file.
source ~/.mutt/gpg.rc		# Source the GPG file.
set sort_alias=alias            # Sort the alias list (alphabetically).
set header_cache=~/.mutt/cache/ # Cache headers for speedier message reading.
set folder=/home/antony/mail    # Default mail folder.
set mbox_type=Maildir           # Type of mbox (inbox).
set postpone=yes                # Postpone messages when not sent immediately?
set postponed=+drafts           # Where to store postponed messages.
set spoolfile=+inbox            # Replaces the environment variable $MAIL.
set copy=yes                    # Save a copy of messages?
set include=yes                 # Include copy of message in reply?
set fast_reply=yes              # Prompt for recipients and subjects?
set beep=no                     # Beep when an error occurs?
set move=no                     # Do not move read messages.
set mark_old=no                 # New unread messages = old after exiting mbox?
set sort=threads                # How to sort messages in index menu.
set mail_check=60               # How often to check for mail (every hour).
set smart_wrap                  # Wrap long lines by words.

# mailboxes - which folders receive mail and will be checked for messages.
mailboxes =inbox =quarantined =college

# my_hdr - Create custom header fields which are added to every message sent.
my_hdr From: Antony Jepson 

# ignore * - ignore all headers then specify only the ones wanted.
ignore *
unignore From:
unignore To:
unignore Reply-To:
unignore Subject:
unignore Date:
unignore CC:
unignore BCC:
unignore X-Virus-Status:

folder-hook .           set record="^"
# ^ = save sent messages in currently open folder

# hdr_order - specify the order to present headers.
hdr_order From: To: Reply-To: CC: BCC: Date: Subject: X-Virus-Status:

# pager_context - specify how many lines that are given when changing pages.
set pager_context=5

# pager_index_lines - specify how many lines of the index to show in the pager.
set pager_index_lines=7

# print_command - defines how should mutt print files
# First convert the file for printing with pr and then pipe the output to
# the printer (without a banner)
set print_command="/usr/bin/pr | /usr/bin/lpr -h"

# custom colour scheme
color   hdrdefault      brightcyan      blue
color   header          brightwhite     blue  "^from:"
color   header          brightwhite     blue  "^subject:"
color   quoted          brightgreen     blue
color   signature       brightwhite     blue
color   indicator       blue            green
color   error           red             black
mono    error           bold
color   status          black cyan
mono    status          bold
color   tree            yellow          blue
color   tilde           blue            blue
color   body            brightwhite     blue  "[-a-z_0-9.]+@[-a-z_0-9.]+"
mono    body            bold                  "[-a-z_0-9.]+@[-a-z_0-9.]+"
color   body            brightyellow    black "^Good signature"
mono    body            bold                  "^Good signature"
color   body            brightwhite     red   "^Bad signature from.*"
mono    body            bold                  "^Bad signature from.*"
color   normal          white           blue
color   message         green           black
color   attachment      brightgreen     blue


If you wondered how I created the diagram, it’s pretty simple:

tmp %  cat mutt.tex


& aliases.rc \\
& cache/ \\
& gpg.rc \\
& lists.rc \\
.mutt \ar@/^/[uuuur]
      \ar@/_1.8pc/[ddddr] & macros.rc \\
& muttrc \\
& muttrc.local1 \\
& muttrc.local2 \\
& muttrc.local3

Take a look at my article on using Xy-pic for some more examples of its capabilities.

Making Diagrams with Xy-pic
8 July 2008

Recently, I upgraded my $latex \LaTeX$ installation from teTeX to TeX Live.  As I was reviewing the available packages, I noticed $latex Xy-pic$, a set of macros for creating diagrams and graphs.  I was immediately intrigued and I started reading the relatively short manual.

Today, I will show you a few of the things $latex Xy-pic$ can do.

1. First, create a file and insert the $latex \LaTeX$ document class and the macro package.

~ % cd ~/tmp
~ % touch example.tex
~ % vim example.tex
1 \documentclass{article}
2 \usepackage[all]{xy}
3 \begin{document}
5 \end{document}

All of our editing will stay between “\begin{document}” and”\end{document}”.

2. Next, let’s begin with our first example.

1 \documentclass{article}
2 \usepackage[all]{xy}
3 \begin{document}
4 \xymatrix@1{A \ar[r] & B}
5 \end{document}

The above example will create:

Explanation: \xymatrix initialises the macro environment and @1 restricts the output to a single line.  \ar creates an arrow and the direction, [r], points the arrow in the right direction.  & separates the columns.  The direction is translated from its mnemonic form (right,left,up,down) into a coordinate pair based upon its initial position.  In this case, [r] means (1,0).  Using [l] would result in an error because [l], which is (-1,0), doesn’t exist.

Throughout the rest of this tutorial, I’ll remove everything except the \xymatrix macro; remember to add the LaTeX commands (lines 1,2, 3, and 5) before you compile the document.  Also, I will bold changes in each progressive example.

3. Let’s add some more letters and arrows to the previous example. (It would have better to use a double headed arrow style, see ex. #7.)

5 \xymatrix@1{A \ar[r] & B \ar[r] & C \ar[l]}

4. Let’s change the C to bullet.

6 \xymatrix@1{A \ar[r] & B \ar[r] & \bullet \ar[l]}

Explanation: \bullet creates a bullet

5. Add another row.

7 \xymatrix{
8 A \ar[r] & B \ar[r] & \bullet \ar[l] \\
9 D & &
10 } 

Explanation: The “\\” creates a linebreak.  Even though no content follows the D, we still have to create the empty columns with &’s.  Since we are now dealing with multiple rows, we have to remove the @1.

6. Create an arrow from A to D.

11 \xymatrix{
12 A \ar[r] \ar[d] & B \ar[r] & \bullet \ar[l] \\
13 D & &
14 }

Explanation: \ar[d] creates a downward arrow to (0,-1), which in this case, is D.

7. Now, let me introduce you to styles.  This time, we’ll begin with a fresh example.

15 \xymatrix@1{
16 A \ar@{<->}[r] & B}

Explanation: The @{<->} is in a @{tail shaft head} format, so in this case, it creates a double-headed arrow.

8. Another example of styling arrows.

17 \xymatrix@1{
18 A \ar@{-}[r] & B}

Explanation: @{-} creates an arrow with only a shaft.

9. Next, an example of labelling arrows.

19 \xymatrix@1{
20 A \ar@{-}[r]^f & B \ar@{-}[r]_f & C }

Explanation: This is not as complicated as it looks.  “^” means up; likewise “_” means down.

10. What about a label with more than one character?

21 \xymatrix@1{
22 A \ar@{-}[r]^{more} & B \ar@{-}[r]_f & C }

Explanation: The “{}” is a container for extra characters.

11. What happens if we lengthen the arrow?

23 \xymatrix@1{
24 A \ar@{-}[rr]^{more} & & B \ar@{-}[r]_f & C }

Explanation: Here, the label stays centered.  Note that we had to modify the direction “[rr]” to account for the blank column between A and B.

12. What about curved arrows?

25 \xymatrix@1{
26 A \ar@{-}@/^/[rr]^{more} & & B \ar@{-}@/_/[r]_f & C }

Explanation: All we did here was add another style “@/^/” and “@/_/”.  /^/ means curve upwards; likewise, /_/ means curve downwards.

13. The last example: a square.

First, we create the outline of the square.

27 \xymatrix{
28 A & B \\
29 C & D
30 }

Next, we connect the corners with arrows.

31 \xymatrix{
32 A \ar[r] \ar[d] & B \ar[d] \\
33 C \ar[r] & D
34 }

Next, we change the styling of the arrows and add labels to each side.

35 \xymatrix{
36 A \ar@{-}[r]^e \ar@{-}[d]_f & B \ar@{-}[d]^g \\
37 C \ar@{-}[r]_h & D
38 }

Finally, let’s add some curved arrows, just for the sake of it.

39 \xymatrix{
40 A \ar@{-}[r]^e \ar@{-}[d]_f & B \ar@{-}[d]^g \ar@/^1pc/[d]\\
41 C \ar@{-}[r]_h \ar@/_1pc/[r]& D
42 }

The added “1pc” makes the curve more prominent so it does not overlap the label.

This tutorial only covers pages 1 – 4 of the 16 page manual.  As you can tell, it is dense.
Xy-pic is a great $latex \LaTeX$ package that can be used to create beautiful diagrams when typesetting documents.

Built with Wordpress and Vim
© 2008 to 2021 Jiff Slater