changeset 471:31079b060068

Update mutt config.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 09 Apr 2019 19:09:04 -0700
parents 3b9394a0a58b
children 97412ea9b3fa
files install.py mutt/muttrc mutt/variables.sample
diffstat 3 files changed, 31 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/install.py	Tue Apr 09 18:58:39 2019 -0700
+++ b/install.py	Tue Apr 09 19:09:04 2019 -0700
@@ -21,6 +21,18 @@
     is_mac = True
 
 
+def _is_executable(fpath):
+    return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
+
+def which(exename):
+    for path in os.environ.get("PATH", "").split(os.pathsep):
+        exepath = os.path.join(path, exename)
+        if _is_executable(exepath):
+            return exepath
+    return None
+
+
 def _p(*paths, force_unix=False):
     res = os.path.join(dotfiles_dir, *paths)
     if force_unix:
@@ -242,8 +254,14 @@
 
 @only_on_nix
 def install_mutt():
+    if which('gpg2'):
+        gpgbin = 'gpg2'
+    else:
+        if not which('gpg'):
+            print("WARNING: no GPG tools seem to be installed!")
+        gpgbin = 'gpg'
     writelines('~/.muttrc', [
-        'source "gpg2 -dq %s |"' % _p('mutt/variables.gpg'),
+        'source "%s -dq %s |"' % (gpgbin, _p('mutt/variables.gpg')),
         'source "%s"' % _p('mutt/muttrc'),
         'source "%s"' % _p('lib/mutt/mutt-colors-solarized/'
                            'mutt-colors-solarized-dark-256.muttrc')
--- a/mutt/muttrc	Tue Apr 09 18:58:39 2019 -0700
+++ b/mutt/muttrc	Tue Apr 09 19:09:04 2019 -0700
@@ -5,19 +5,18 @@
 
 
 # Folders... apparently Mutt doesn't pull all of them automatically.
-mailboxes = "imaps://$my_imap/$my_folder_inbox" \
-            "imaps://$my_imap/Sent Items" \
-            "imaps://$my_imap/Drafts" \
-            "imaps://$my_imap/Archive" \
-            "imaps://$my_imap/MailingLists" \
-            "imaps://$my_imap/Newsletters" \
-            "imaps://$my_imap/Trash"
-
+#mailboxes = "imaps://$my_imap/$my_folder_inbox" \
+#            "imaps://$my_imap/Sent Items" \
+#            "imaps://$my_imap/Drafts" \
+#            "imaps://$my_imap/Archive" \
+#            "imaps://$my_imap/MailingLists" \
+#            "imaps://$my_imap/Newsletters" \
+#            "imaps://$my_imap/Trash"
 
 # Basic config
 #set editor = "vim"
 set editor = "vim +/^$ ++1 -c 'set tw=76 expandtab nosmartindent spell'"
-#set hostname = "$my_hostname"
+set hostname = "$my_hostname"
 set header_cache=~/.mutt/cache/headers
 set message_cachedir=~/.mutt/cache/bodies
 set certificate_file=~/.mutt/certificates
--- a/mutt/variables.sample	Tue Apr 09 18:58:39 2019 -0700
+++ b/mutt/variables.sample	Tue Apr 09 19:09:04 2019 -0700
@@ -1,14 +1,5 @@
 # Account details
-set my_imap=<imap URL and port>
-set my_smtp=<smtp URL and port>
-set my_user=<imap username>
-set my_pass=<imap password>
-set my_hostname=<hostname>
-set my_realname="<your name>"
-
-# Account folders
-set my_url=<imap URL>
-set my_folder_inbox=<inbox>
-set my_folder_sent=<sent>
-set my_folder_drafts=<drafts>
-
+set my_user=name@domain.com
+set my_pass=yourpassword
+set my_hostname=yourmachine
+set my_realname="Your Name"