From b0e7e9096efa88ff34f2f33f71e99a1c2eeffa32 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 14 Feb 2021 23:07:14 -0500 Subject: [PATCH] mutt: update configs --- .config/mutt/bindings.rc | 5 +++ .config/mutt/formatting.rc | 9 ++++-- .config/mutt/gpg.rc | 7 ++-- .config/mutt/list-mailboxes.py | 59 +++++++++++----------------------- .config/mutt/main.rc | 2 ++ .config/mutt/sidebar.rc | 1 + 6 files changed, 38 insertions(+), 45 deletions(-) diff --git a/.config/mutt/bindings.rc b/.config/mutt/bindings.rc index 2f74820..593248c 100644 --- a/.config/mutt/bindings.rc +++ b/.config/mutt/bindings.rc @@ -1,8 +1,13 @@ # http://www.mutt.org/doc/manual/manual-6.html#functions +#bind generic \Cc exit +#quit +set quit=ask-no + bind index , current-middle bind index t noop bind index T noop +bind index V collapse-all bind index x tag-entry bind index X tag-pattern bind index previous-line diff --git a/.config/mutt/formatting.rc b/.config/mutt/formatting.rc index b8fcf04..67e957b 100644 --- a/.config/mutt/formatting.rc +++ b/.config/mutt/formatting.rc @@ -43,7 +43,7 @@ set folder_format="%F %d %8s %f" # file browser menu set folder_format="sh -c '~/.config/mutt/folder.sh \"$@\"' -- '%f' '%F %d %8s'|" # http://www.mutt.org/doc/devel/manual.html#index-format -set index_format = "%4C %Z %?M?»& ?%s %* %B %-20.20n %D" +set index_format = "%Z%?M?»& ?%s %* %B %-20.20n %D" #set pager_format="-%Z- %C/%m [%[%H:%M]] %-17.17n %s" @@ -58,8 +58,13 @@ set index_format = "%4C %Z %?M?»& ?%s %* %B %-20.20n %D" # %??? print iff is non zero # %??&? # -#set status_format="[%r] %h %f (%s) [%M/%m] [N=%n,*=%t,post=%p,new=%b]" +set status_format="[%r] %h %f (%s) [%M/%m] [N=%n,*=%t,post=%p,new=%b]" #set status_format="-%r-%v--[%?M?%M/?%m msgs%?n?, %n new?%?d?, %d del?%?F?, %F flag?%?t?, %t tag?%?p?, %p postp?%?b?, %b inc?%?l?, %l?]--(%f)--%s/%S-%>-%P-" #set status_format="-%r-%v--[%?M?%M/?%m msgs%?n?, %n new?%?d?, %d del?%?F?, %F flag?%?t?, %t tag?%?p?, %p postp?%?b?, %b inc?%?l?, ?%?L?%L/?%?l?%l?]--(%f)--%s/%S-%>-%P-" #set status_format="-%r-%v--[%?M?%M/?%m msgs%?n?, %n new?%?d?, %d del?%?F?, %F flag?%?t?, %t tag?%?p?, %p postp?%?b?, %b inc?%?l?, %l?]--(%f)--%s-%>-%P-" #set status_format = "───[ Folder: %f ]───[%r%m messages%?n? (%n new)?%?d? (%d to delete)?%?t? (%t tagged)? ]───%>─%?p?( %p postponed )?───" + +# https://dev.mutt.org/doc/manual.html#ts-enabled +# Set the terminal status line (title). +set ts_enabled = yes +set ts_status_format = "%v %h %f" diff --git a/.config/mutt/gpg.rc b/.config/mutt/gpg.rc index 0b0ef16..b986d13 100644 --- a/.config/mutt/gpg.rc +++ b/.config/mutt/gpg.rc @@ -11,13 +11,14 @@ set pgp_use_gpg_agent = yes # breaking PGP/MIME. # decode application/pgp -set pgp_decode_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f" +set pgp_decode_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f 2>/dev/null" +# 2>&1 | grep -E -v '^gpg:.+(aka|Signature made)'" # verify a pgp/mime signature -set pgp_verify_command="gpg --status-fd=2 --no-verbose --quiet --batch --output - --verify %s %f 2>&1 | grep -E -v '^gpg:.+(aka|Signature made)'" +set pgp_verify_command="gpg --status-fd=2 --no-verbose --quiet --batch --output - --verify %s %f 2>/dev/null" # decrypt a pgp/mime attachment -set pgp_decrypt_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f" +set pgp_decrypt_command="gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f 2>/dev/null" # create a pgp/mime signed attachment set pgp_sign_command="gpg --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f" diff --git a/.config/mutt/list-mailboxes.py b/.config/mutt/list-mailboxes.py index f6e0a01..3737d7a 100755 --- a/.config/mutt/list-mailboxes.py +++ b/.config/mutt/list-mailboxes.py @@ -1,70 +1,49 @@ -#!/usr/bin/python +#!/usr/bin/python3 """Produce a "sorted" list of maildir paths based on subdirs.""" from __future__ import print_function import os +from pathlib import Path import sys -IGNORED_DIRS = set(( +IGNORED_DIRS = { 'drafts', 'outbox', 'templates', '.inbox.directory', -)) +} +MAILDIR_DIRS = { + 'cur', 'new', 'tmp', +} 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'): + for d in sorted(topdir.iterdir()): + if d.name in MAILDIR_DIRS: continue - fulld = os.path.join(topdir, d) - if d.startswith('.') or fulld in ignored: + if d 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 + if not d.is_symlink(): + if (d / 'cur').is_dir(): + yield d + subdir = topdir / f'.{d.name}.directory' + if subdir not in ignored and subdir.is_dir(): + yield from find_dirs(subdir, ignored) def main(argv): - maildir = os.path.expanduser('~/.mail/') - results = [] - ignored = set(os.path.join(maildir, x) for x in IGNORED_DIRS) + maildir = Path('~/.mail/').expanduser() + ignored = {maildir / x for x in IGNORED_DIRS} results = find_dirs(maildir, ignored) - print(' '.join('"%s"' % x for x in results)) + print(' '.join(f'"{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/main.rc b/.config/mutt/main.rc index b8c3092..d21b300 100644 --- a/.config/mutt/main.rc +++ b/.config/mutt/main.rc @@ -22,6 +22,8 @@ set sort = threads set strict_threads = yes set sort_browser = alpha set sort_aux = last-date-received +set help = no +set hide_missing = no set hide_thread_subject = yes #set menu_scroll = yes set pager_context = 10 diff --git a/.config/mutt/sidebar.rc b/.config/mutt/sidebar.rc index 07b38b5..5a8db6e 100644 --- a/.config/mutt/sidebar.rc +++ b/.config/mutt/sidebar.rc @@ -2,6 +2,7 @@ set sidebar_divider_char = '│ ' set sidebar_folder_indent = yes set sidebar_format = '%B %* %N' # %F %S' set sidebar_indent_string = ' ' +set sidebar_relative_shortpath_indent = no set sidebar_short_path = yes set sidebar_visible = yes set sidebar_width = 30 -- 2.39.5