From 6bf5458d76dd7a844cb748f61bc8536365e0e269 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 29 Dec 2016 18:17:15 -0500 Subject: [PATCH] mutt: update settings for newer release --- .config/mutt/list-mailboxes.py | 70 ++++++++++++++++++++++++++++ .config/mutt/lists.rc | 9 +++- .config/mutt/mail.rc | 5 +- .config/mutt/main.rc | 1 + .config/mutt/sidebar.rc | 13 ++++-- .config/mutt/theme/xterm-256color.rc | 1 + 6 files changed, 88 insertions(+), 11 deletions(-) create mode 100755 .config/mutt/list-mailboxes.py create mode 100644 .config/mutt/theme/xterm-256color.rc diff --git a/.config/mutt/list-mailboxes.py b/.config/mutt/list-mailboxes.py new file mode 100755 index 0000000..f6e0a01 --- /dev/null +++ b/.config/mutt/list-mailboxes.py @@ -0,0 +1,70 @@ +#!/usr/bin/python + +"""Produce a "sorted" list of maildir paths based on subdirs.""" + +from __future__ import print_function + +import os +import sys + + +IGNORED_DIRS = set(( + 'drafts', + 'outbox', + 'templates', + '.inbox.directory', +)) + + +def find_dirs(topdir, ignored): + """Walk the subdirs following the KDE layout.""" + ret = [] + for d in sorted(os.listdir(topdir)): + if d in ('cur', 'new', 'tmp'): + continue + + fulld = os.path.join(topdir, d) + if d.startswith('.') or fulld in ignored: + continue + if not os.path.islink(fulld): + if os.path.isdir(os.path.join(fulld, 'cur')): + ret.append(fulld) + subdir = os.path.join(topdir, '.%s.directory' % d) + if subdir not in ignored and os.path.isdir(subdir): + ret.extend(find_dirs(subdir, ignored)) + + return ret + + +def main(argv): + maildir = os.path.expanduser('~/.mail/') + results = [] + ignored = set(os.path.join(maildir, x) for x in IGNORED_DIRS) + + results = find_dirs(maildir, ignored) + print(' '.join('"%s"' % x for x in results)) + return 0 + + +# Old logic that doesn't sort right. + for root, dirs, _ in os.walk(maildir, followlinks=False): + for d in ('cur', 'new', 'tmp'): + try: + dirs.remove(d) + except ValueError: + pass + + dirs.sort() + for d in dirs[:]: + fulld = os.path.join(root, d) + if fulld in ignored: + dirs.remove(d) + elif not os.path.islink(fulld): + if os.path.isdir(os.path.join(fulld, 'cur')): + results.append(fulld) + + print('\n'.join('"%s"' % x for x in results)) + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/.config/mutt/lists.rc b/.config/mutt/lists.rc index 353c093..9ebe7b7 100644 --- a/.config/mutt/lists.rc +++ b/.config/mutt/lists.rc @@ -13,7 +13,12 @@ subscribe -group oss \ "^LINUX-390@VM\.MARIST\.EDU$" \ "^procps@freelists.org$" \ "@lists\.denx\.de$" \ - "@lists\.linux\.it$" -subscribe -group gnu "(^bug-.*|-(dev(el)?|patches))@(non)?gnu\.org$" "@debbugs\.gnu\.org$" "^(auto(conf|make)|coreutils|libtool)@gnu\.org$" + "@lists\.linux\.it$" \ + "@lists\.php\.net$" \ + "^security@libgd\.org$" +subscribe -group gnu \ + "(^(bug|help|info)-.*|-(dev(el)?|patches))@(non)?gnu\.org$" \ + "@debbugs\.gnu\.org$" \ + "^(auto(conf|make)|coreutils|libtool)@gnu\.org$" subscribe -group spec "-l@opengroup\.org$" subscribe -group unicode "-users@unicode\.org" diff --git a/.config/mutt/mail.rc b/.config/mutt/mail.rc index 52e18ac..1a7e2f2 100644 --- a/.config/mutt/mail.rc +++ b/.config/mutt/mail.rc @@ -8,8 +8,5 @@ set postponed = +/drafts set header_cache = ~/.cache/mutt/header set message_cachedir = ~/.cache/mutt/message -mailboxes `find ~/.mail/ \ - -regextype posix-extended -type d \ - '(' -regex '.*/(cur|new|tmp)$' -o -regex '.*/\.mail/(drafts|outbox|templates|\.inbox\.directory)$' -prune ')' \ - -name cur -printf '"%h" ' 2>/dev/null | sort` +mailboxes `~/.config/mutt/list-mailboxes.py` unmailboxes ~/.mail diff --git a/.config/mutt/main.rc b/.config/mutt/main.rc index ec30eec..b8c3092 100644 --- a/.config/mutt/main.rc +++ b/.config/mutt/main.rc @@ -30,6 +30,7 @@ set pager_stop = yes set autoedit = yes set editor = "nano -r 80" set fast_reply = yes +#set reply_regexp = "^(([Rr][Ee]|[aA][wW]):[[:space:]]*)*" set include = yes ignore * diff --git a/.config/mutt/sidebar.rc b/.config/mutt/sidebar.rc index a3a03a0..07b38b5 100644 --- a/.config/mutt/sidebar.rc +++ b/.config/mutt/sidebar.rc @@ -1,12 +1,15 @@ -set sidebar_delim = '│' -set sidebar_folderindent = yes +set sidebar_divider_char = '│ ' +set sidebar_folder_indent = yes set sidebar_format = '%B %* %N' # %F %S' -set sidebar_indentstr = ' ' -set sidebar_shortpath = yes -set sidebar_sort = yes +set sidebar_indent_string = ' ' +set sidebar_short_path = yes set sidebar_visible = yes set sidebar_width = 30 +# Needed so stats show up in the sidebar. +set mail_check_stats = yes +set mail_check_stats_interval = 600 + color sidebar_new brightred default bind index \Ck sidebar-prev diff --git a/.config/mutt/theme/xterm-256color.rc b/.config/mutt/theme/xterm-256color.rc new file mode 100644 index 0000000..596d5c2 --- /dev/null +++ b/.config/mutt/theme/xterm-256color.rc @@ -0,0 +1 @@ +source ~/.config/mutt/theme/256color.rc -- 2.39.5