## Handy Hint

# If you use vim, add this to your .vimrc file, without the comment:
#   au BufNewFile,BufRead   .mutt\/*    so $VIMRUNTIME/syntax/muttrc.vim
# This will allow you to edit any of the files in .mutt/ with the same
# lovely, clear colours as .muttrc. Hurrah!


## Import Common Settings

# These are common settings that may be rsynced across hosts,
# leaving all the host or person specific settings here.
source ~/.mutt/common

## Personal

# realname is kinda redundant, since I set my From header
set realname="Jeff Waugh"
# alternates 'lists' my personal email addresses which should be highlighted
set alternates = "jdub@(aphid.net|perkypants.org|slug.org.au|gnome.org)"
# various headers, including the very important From header
my_hdr  From: Jeff Waugh <jdub@perkypants.org>
# this is yet another Outlook Annoyer, makes it high priority, etc
#my_hdr Reply-By: `date --date="+3 days"`
# Outlook Annoyer: Flags and tags each email fairly obviously
my_hdr  X-Message-Flag: Cranky? Try Free Software instead!
# Tell people about my OS
my_hdr  X-Operating-System: `uname -srm`


## Mailboxes

# these set up my favourite mbox folder layout
#set folder=~/Mail
#set mbox=~/Mail/INBOX
#set record=~/Mail/Sent
#set spoolfile=~/Mail/INBOX

# for my Maildir setup, I use these settings
# note the mbox_type setting and the slashes at the end
set mbox_type=Maildir
set mbox=~/Maildir/
set folder=~/Maildir/
set record="~/Maildir/.Sent/"
set spoolfile=~/Maildir/

# instead of typing out all my mailboxes, I let find do the walking
# this shows all of my mbox IN* boxes, and not the archives
#mailboxes `find ~/Mail/ -type f ! -name "Sent" ! -name ".*" ! -name "*.archive" ! -regex ".*Archives.*" -printf "=%P "`
# This one shows all my Maildir mailboxes
#mailboxes `find ~/Maildir/ -type d ! -ipath "*archive*" ! -regex ".*\(cur\|new\|tmp\)$" -printf "=\"%P\" "`
mailboxes =

# this is an awesome little macro that re-reads your mailbox list
# every time you look at the mutt folder list -> perky! just hit
# the left cursor key when you're viewing mail
#macro  index   <left>  ':mailboxes `find ~/Mail/ -type f ! -name "Sent" ! -name ".*" ! -name "*.archive" ! -regex ".*Archives.*" -printf "=%P "`<enter>c?<toggle-mailboxes>'
# Maildir:
macro   index   <left>  ':mailboxes `find ~/Maildir/ -type d -maxdepth 1 ! -ipath "*archive*" ! -regex ".*\(cur\|new\|tmp\)$" -printf "=%P "`<enter>c?<toggle-mailboxes>'

# this just runs my fetchall script when I hit "F" in mutt
# it varies between host, so I keep it here
macro   index   F   '!fetchall<enter>'

# Bogofilter keys and modifications
# Save commands
macro   index   s   "<enter-command>unset wait_key\n<pipe-entry>bogofilter -n -S\n<enter-command>set wait_key\n<save-entry>"
macro   pager   s   "<enter-command>unset wait_key\n<pipe-entry>bogofilter -n -S\n<enter-command>set wait_key\n<save-entry>"
## Reply commands
macro   index   r   "<enter-command>unset wait_key\n<pipe-entry>bogofilter -n\n<enter-command>set wait_key\n<reply>"
macro   pager   r   "<enter-command>unset wait_key\n<pipe-entry>bogofilter -n\n<enter-command>set wait_key\n<reply>"
macro   index   g   "<enter-command>unset wait_key\n<pipe-entry>bogofilter -n\n<enter-command>set wait_key\n<group-reply>"
macro   pager   g   "<enter-command>unset wait_key\n<pipe-entry>bogofilter -n\n<enter-command>set wait_key\n<group-reply>"
macro   index   L   "<enter-command>unset wait_key\n<pipe-entry>bogofilter -n\n<enter-command>set wait_key\n<list-reply>"
macro   pager   L   "<enter-command>unset wait_key\n<pipe-entry>bogofilter -n\n<enter-command>set wait_key\n<list-reply>"
## harsh delete commands
macro   index   X   "<enter-command>unset wait_key\n<pipe-entry>bogofilter -s\n<enter-command>set wait_key\n<delete-message>"
macro   pager   X   "<enter-command>unset wait_key\n<pipe-entry>bogofilter -s\n<enter-command>set wait_key\n<delete-message>"


#macro  index   X   "<enter-command>unset wait_key\n<pipe-entry>sa-learn --single --spam\n<enter-command>set wait_key\n<delete-message>"
#macro  pager   X   "<enter-command>unset wait_key\n<pipe-entry>sa-learn --single --spam\n<enter-command>set wait_key\n<delete-message>"


#macro index z "<enter-command>set sort=reverse-date-received\n<enter-command>set sort=threads\n"

## New mails in new windows
#macro   index   m   '<enter-command>unset wait_key\n!if [ $DISPLAY ] && [ -x $(which gnome-terminal) ]; then gnome-terminal --use-factory -x mutt """"; else mutt """"; fi\n<enter-command>set wait_key\n'
#macro   index   M   '<mail>'


## Lists

# this is an exhaustive list of mailing list addresses (i didn't bother
# with the domain component) so that I can use Mutt's brillo List Reply feature
# Started using the "subscribe" feature, instead of "lists", see
# http://www.mutt.org/doc/manual/manual-3.html#ss3.9
subscribe slug@ slug-chat@ committee festies linux-aus aussie-isp
subscribe crackmonkey linux-elitists geeks slarken gimpnet-opers
subscribe gnome foundation- debian- desktop-devel-list nautilus-
subscribe kcdevel table64 edt spankies usability lnx-bbc garnome-list
subscribe release- lug board guadec xdg-list marketing-list


## Bits 'n' Pieces

# These two are for using mutt remotely, although I now use them on my desktop
# too. Why? Well, I use a font that doesn't have all the cool terminal stuff in
# it, so I use ascii_chars to make it readable. I use the minimal arrow_cursor
# in lists because I have a text terminal to use mutt with. I've kept these out
# of .mutt/common for portability and personal preference reasons. ;)
set ascii_chars = yes
set arrow_cursor = yes


## Local Hooks

# here's where the fun begins! all of these send-hooks that match with . are
# defaults, so will work in any folder until they're specifically overridden

# this send-hook allows us to read in the output of my signature.py utility
# on every email send command
send-hook       .               'set signature = "/home/jdub/bin/signature |"'

# i reset these too, because some hooks may change them. with mutt, your last
# setting sticks, so it's best to override all the settings that you change
send-hook       .               'set attribution = "<quote who=\"%n\">\n"'
send-hook       .               'my_hdr From: Jeff Waugh <jdub@perkypants.org>'
send-hook       .               'my_hdr Reply-By: `date --date="+3 days"`'
send-hook       .               'my_hdr X-Operating-System: `uname -srm`'
send-hook       .               'my_hdr X-Message-Flag: Cranky? Try Free Software instead!'
send-hook       .               'my_hdr X-Uptime: `uptime`'

# this sets a special save hook so that I can be slightly lazy when shunting
# mail off to archived folders. I really ought to improve this though. It's a pity
# that you can't do funky regexp stuff to change folder names, etc.
# I only used these for my mbox setup
folder-hook     =               'save-hook ~A =Archives/%u'
folder-hook     .               'save-hook ~A =Archives/%B'
#save-hook      "~h List-Id"    '=Lists/%B'
#save-hook      "~e slug"       '=SLUG/%B'

# when I'm in my slug folders or sending to a slug address, set my from header
# so that I am a real SLUG dude
#folder-hook        =SLUG/*         'my_hdr From: Jeff Waugh <jdub@perkypants.org>'
send-hook       slug@slug       'my_hdr From: Jeff Waugh <jdub@perkypants.org>'
send-hook       announce@slug   'my_hdr From: Jeff Waugh <jdub@slug.org.au>'
send-hook       slug@slug       'unmy_hdr X-Operating-System'
send-hook       slug@slug       'unmy_hdr X-Message-Flag'
send-hook       slug@slug       'unmy_hdr X-Uptime'
send-hook       slug@slug       'unmy_hdr Reply-By'

# for some reason I decided to be mysterious when sending to the new slug-chat
# list, so I set from headers and signatures differently. there are lots of other
# evil bastard things that I should do here.
send-hook       slug-chat@slug  'my_hdr From: invisible ink <jdub@perkypants.org>'
send-hook       slug-chat@slug  'set attribution = "%n:\n"'
send-hook       slug-chat@slug  "set signature = 'echo \"\n\n- ii\n\n-- \n  Penguinillas Pack GNUzis\" |'"

# have to use my old address, and I couldn't be bothered resubbing
send-hook   aussie-isp      "my_hdr From: Jeff Waugh <jdub@aphid.net>"
send-hook   motd@zork.net   "my_hdr From: Jeff Waugh <jdub@zork.net>"

send-hook   mailman-owner@solutionsfirst.com.au 'set attribution = "<quote who=\"The Oracle\">\n"