#
# Personal configuration file for  Mutt
#
# use visual and "gq" to reformat quote
#set editor="jvim -c 'set tw=72 et'"
#set editor="vim -c 'set tw=72 et comments=n:>,n:\\|'"
set editor="vim -c 'set tw=72 et ft=mail'"
#set editor="mcedit"
#set markers=no            # no '+' for long line
#set ispell="aspell -e -c"
#
# header weeding taken from the manual (Sven's draconian header weeding)
#
ignore *
unignore from: date subject to cc
unignore x-spam:  X-CRM114-Status:
hdr_order from subject to cc date X-CRM114-Status: x-spam:

#color index         cyan            default   '~p ~N'

# this host get mail from debian@aokiconsulting.com by fetchmail
# generate a From header as debian@aokiconsulting.com
set use_from
# set for Inbox
#set from="Osamu Aoki <debian@aokiconsulting.com>"
set from="Osamu Aoki <osamu@debian.org>"
set signature="~/.signature"

#set reverse_name
set reply_self
set mime_forward=ask-yes

# set encoding: default order = us-ascii --> iso-8859-1 --> utf-8 
# (UTF-8 support is not popular for Japanese)
#set send_charset="us-ascii:iso-8859-1:utf-8"
# set encoding: order = us-ascii --> iso-8859-1 --> iso-2022-jp --> utf-8
#set send_charset="us-ascii:iso-8859-1:iso-2022-jp:utf-8"
# set encoding: order = us-ascii --> iso-8859-1 --> iso-2022-jp
set send_charset="us-ascii:iso-8859-1:iso-2022-jp"
set allow_8bit=no

# add funny header
#my_hdr No-MicroSoft-Client-Please: GNU/Linux RULEZ !!
#my_hdr X-GPG-Fingerprint: 814E BD64 3288 40E7 E88E  3D92 C3F8 EA94 D5DE 453D
my_hdr X-GPG-Fingerprint: 253A 4076 6A3B CCE2 A426  DEF5 E80F C4C1 A806 1F32

# Set personal alias file
set alias_file=~/.mutt_aliases
source ~/.mutt_aliases

# "mutt" goes to Inbox, while "mutt -y" lists mailboxes
set mbox_type=Maildir		# use qmail Maildir format for creating mbox
set mbox=~/Mail                 # keep all mail boxes in $HOME/Mail/
set spoolfile=+Inbox		# mail delivered to $HOME/Mail/Inbox
set record=+Outbox		# save fcc mail to $HOME/Mail/Outbox
set postponed=+Postponed	# keep postponed in $HOME/Mail/postponed
set move=no			# do not move Inbox items to mbox
set quit=ask-yes		# do not quit by "q" only
set delete=yes  		# always delete w/o asking while exiting
set fcc_clear			# store fcc as non encrypted

# Mailboxes (automatic update)
#mailboxes `/bin/ls -1 $HOME/Proc|grep -v Maillog|sed -e 's/^/+/' | tr "\n" " "`
#mailboxes `/bin/ls -1 ~/Mail|grep -v Maillog|sed -e 's/^/+/' | tr "\n" " "`
unmailboxes Maillog *.ev-summary
mailboxes `cd ~/Mail; /bin/ls -1|grep -v Maillog |grep -v "\.ev-summary" |sed -e 's/^/+/' | tr "\n" " "`

# colors
#color normal    white black
color normal    brightcyan black
color attachment brightyellow black
color hdrdefault cyan black
color indicator black cyan
color markers   brightred black
color quoted    green black
color signature cyan black
color status    brightgreen blue
color tilde     blue black
color tree      red black
color header   brightgreen black ^From:
color header   brightcyan black ^To:
color header   brightcyan black ^Reply-To:
color header   brightcyan black ^Cc:
color header   brightblue black ^Subject:
color body     brightred black [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+
color body     brightblue black (https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+



# Extra key bindings
set auto_tag					# always act on tag
bind generic <insert> tag-entry			# tag message in index
bind index <delete> delete-message
bind pager <insert> tag-message			# tag message in pager
bind pager <delete> delete-message
unset pager_stop
macro pager z ":toggle pager_stop\n"	# stop at the end (z)?
bind pager \' toggle-quoted		# T is hard to use

#macro index c <change-folder>?	# redefine c
macro index c <change-folder>?\n\t	# redefine c, may add <tab>
#macro index c <change-folder>?\n	# redefine c, may add <tab>
macro index S ":toggle pgp_verify_sig\n"	# define S to toggle sig check
#macro index G ":toggle followup_to\n"	# define G to toggle ML (no POP)

macro index  <F2> ':set signature="~/.signature.aoki"; set from="Osamu Aoki <debian@aokiconsulting.com>"' # set sig to aokiconsulting.com
macro index  <F3> ':set signature="~/.signature.debian"; set from="Osamu Aoki <osamu@debian.org>"' # set sig to debian.org

######
#macro index  a "|grep -a -v \"X-CRM114-\" |crm -u /home/osamu/crm114 mailfilter.crm --force --learnnonspam |grep -a \"X-CRM114-\" \n"
#macro index  z "|grep -a -v \"X-CRM114-\" |crm -u /home/osamu/crm114 mailfilter.crm --force --learnspam |grep -a \"X-CRM114-\" \n"
#macro index  \` "|grep -a -v \"X-CRM114-\" |crm -u /home/osamu/crm114 mailfilter.crm --force|grep -a \"X-CRM114-Status:\" \n"

macro index X "|/usr/share/crm114/mailfilter.crm -u ~/.crm114/ --force --learnspam\n<save-message>=Xspam-crm-x\n"
macro index H "|/usr/share/crm114/mailfilter.crm -u ~/.crm114/ --force --learnnonspam\n<save-message>!\n"
#macro index \` "|grep -a -v -e \"X-CRM114-\"|/usr/share/crm114/mailfilter.crm -u ~/.crm114/|grep -a -e \"X-CRM114-Status:\" \n"
#macro index \` "|grep -a -v -e \"X-CRM114-\"|/usr/share/crm114/mailfilter.crm -u ~/.crm114/|grep -a -e \"X-CRM114-Status:\" \n"
macro index \` "|grep -a -v -e \"X-CRM114-\"|/usr/share/crm114/mailfilter.crm -u ~/.crm114/|grep -a -e \"X-CRM114-Status:\" \n"

macro pager X "|/usr/share/crm114/mailfilter.crm -u ~/.crm114/ --force --learnspam\n<save-message>=Xspam-crm-x\n"
macro pager H "|/usr/share/crm114/mailfilter.crm -u ~/.crm114/ --force --learnnonspam\n<save-message>!\n"
#macro pager \` "|grep -a -v \"X-CRM114-\"|/usr/share/crm114/mailfilter.crm -u ~/.crm114/|grep -a \"X-CRM114-Status:\" \n"

# Defaults
folder-hook =jp-osamu      'set signature="~/.signature.osamu";  set from="Osamu Aoki <osamu@aokiconsulting.com>"'
folder-hook =debian-user   'set signature="~/.signature.user";   set from="Osamu Aoki <debian@aokiconsulting.com>"'
folder-hook .              'set signature="~/.signature.debian"; set from="Osamu Aoki <osamu@debian.org>"'

#folder-hook  . 'push ot'		# default thread
#folder-hook . 'push ot<esc>V'		# default thread colapse

# Expire most Debian lists after two weeks(2w).
folder-hook =debian-(devel|policy|boot|user|testing)$ "push '<delete-pattern> ~d >2w\n'"

## Thread index with adresee (non-collapse, default)
#set index_format="%4C %Z %{%b %d} %-15.15L (%4l) %s"
## Thread index with me-to-list & senders (non-collapse)
#set index_format="%4C %Z %{%b %d} %-15.15F (%4l) %s"
## Thread index with adresee (collapse)
#set index_format="%4C %Z %{%b %d} %-15.15L %?M?(#%03M)&(%4l)? %s"
## Thread index with me-to-list & senders (collapse)
#set index_format="%4C %Z %{%b %d} %-15.15F %?M?(#%03M)&(%4l)? %s"
## Thread index with with file size me-to-list & senders
#set index_format="%3C %Z %{%b%d} %-15.15F (%4c) %s"

## Thread index with senders (collapse)
set index_format="%4C %Z %{%b %d} %-15.15n %?M?(#%03M)&(%4l)? %s"

# all important moves within pager redefined here for easy customization
#bind pager <space> next-page
bind pager <up> previous-page
bind pager <down> next-page
#bind pager <left> previous-undeleted
#bind pager <right> next-undeleted
bind pager * previous-line
bind pager - half-up
bind pager + half-down
#bind pager <enter> next-line

# GnuPG configuration
#set pgp_sign_as="D5DE453D"
set pgp_sign_as="A8061F32"
#set pgp_autosign
set pgp_verify_sig=no
#set pgp_verify_sig=yes

##
## More settings
##

# ML
# For list reply only (Press L)
lists mutt-users@mutt.org mutt-users@gbnet.net \
    debian-user@lists.debian.org \
    debian-laptop@lists.debian.org \
    debian-doc@lists.debian.org \
    debian-www@lists.debian.org \
    debian-devel@lists.debian.org \
    debian-mentors@lists.debian.org \
    debian-newmaint@lists.debian.org \
    debian-legal@lists.debian.org \
    debian-policy@lists.debian.org \
    debian-firewall@lists.debian.org \
    debian-laptop@lists.debian.org \
    debian-boot@lists.debian.org \
    debian-testing@lists.debian.org \
    debian-i18n@lists.debian.org \
    debian-private@lists.debian.org \
    debian-events-eu@lists.debian.org \
    debian-japanese@lists.debian.org \
    debian-users@debian.or.jp \
    debian-private@debian.or.jp \
    debian-devel@debian.or.jp \
    bad@bad.debian.net \
    newbiedoc-discuss@lists.sourceforge.net \
    qref-developers@lists.sourceforge.net \
    vim@vim.org \
    help-gnu-emacs@gnu.org \


# List by mailinglist name
subscribe mutt-users@mutt.org mutt-users@gbnet.net \
    debian-user@lists.debian.org \
    debian-laptop@lists.debian.org \
    debian-doc@lists.debian.org \
    debian-www@lists.debian.org \
    debian-devel@lists.debian.org \
    debian-mentors@lists.debian.org \
    debian-newmaint@lists.debian.org \
    debian-legal@lists.debian.org \
    debian-policy@lists.debian.org \
    debian-firewall@lists.debian.org \
    debian-laptop@lists.debian.org \
    debian-boot@lists.debian.org \
    debian-testing@lists.debian.org \
    debian-i18n@lists.debian.org \
    debian-private@lists.debian.org \
    debian-japanese@lists.debian.org \
    debian-users@debian.or.jp \
    debian-private@debian.or.jp \
    debian-devel@debian.or.jp \
    debian-curiosa@lists.debian.org \
    debian-vote@lists.debian.org \
    bad@bad.debian.net \
    newbiedoc-discuss@lists.sourceforge.net \
    qref-developers@lists.sourceforge.net \
    vim@vim.org \
    help-gnu-emacs@gnu.org \

# weed out binary-only announcements to -devel-changes by control-W
#macro index \CW T!~s\(.*source.*\)\nWn^T~A\n "Weed out binary-only announcements"

# If your sendmail supports the -B8BITMIME flag, enable the following
#
#set use_8bitmime

#
#
#folder-hook =Inbox 'push od'		# date
#folder-hook =Outbox 'push od'		# date
#folder-hook =Spam 'push od'		# date
#folder-hook =Returned 'push od'		# date
#folder-hook =Postponed 'push od'	# date

# GnuPG configuration
set pgp_decode_command="/usr/bin/gpg   --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet  --batch  --output - %f"
set pgp_verify_command="/usr/bin/gpg   --keyserver-options  auto-key-retrieve  --status-fd=2 --no-verbose --quiet  --batch  --yes --output - --verify %s %f"
set pgp_decrypt_command="/usr/bin/gpg   --status-fd=2 --passphrase-fd 0 --no-verbose --quiet  --batch  --output - %f"
set pgp_sign_command="/usr/bin/gpg    --no-verbose --batch --quiet   --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f"
set pgp_clearsign_command="/usr/bin/gpg   --no-verbose --batch --quiet   --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f"
set pgp_encrypt_only_command="/usr/lib/mutt/pgpewrap /usr/bin/gpg    --batch  --quiet  --no-verbose --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"
set pgp_encrypt_sign_command="/usr/lib/mutt/pgpewrap /usr/bin/gpg  --passphrase-fd 0  --batch --quiet  --no-verbose  --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f"
set pgp_import_command="/usr/bin/gpg  --no-verbose --import -v %f"
set pgp_export_command="/usr/bin/gpg   --no-verbose --export --armor %r"
set pgp_verify_key_command="/usr/bin/gpg   --verbose --batch  --yes --fingerprint --check-sigs %r"
set pgp_list_pubring_command="/usr/bin/gpg   --no-verbose --batch --quiet   --with-colons --list-keys %r" 
set pgp_list_secring_command="/usr/bin/gpg   --no-verbose --batch --quiet   --with-colons --list-secret-keys %r" 
set pgp_good_sign="^\\[GNUPG:\\] GOODSIG"