summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-08-17 19:03:51 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-08-17 19:03:51 +0100
commit2a8f34cfb9e5815ab0b57f64d6a6616da4edeefb (patch)
tree0881a48771ee04fce04aea65d6ec1745a55950ad /alot
parent86af234229e3986f6e46c06f35ba51e0ad710f25 (diff)
access notmuch's config via settings.notmuchconfig
This adds a comdline option "-n" to specify the location of notmuch's config file and splits the CustomConfigparser
Diffstat (limited to 'alot')
-rwxr-xr-xalot/init.py7
-rw-r--r--alot/settings.py17
2 files changed, 20 insertions, 4 deletions
diff --git a/alot/init.py b/alot/init.py
index 689e677d..e5a13a5b 100755
--- a/alot/init.py
+++ b/alot/init.py
@@ -31,7 +31,10 @@ def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('-c', dest='configfile',
default='~/.alot.rc',
- help='config file')
+ help='alot\'s config file')
+ parser.add_argument('-n', dest='notmuchconfigfile',
+ default='~/.notmuch-config',
+ help='notmuch\'s config file')
parser.add_argument('-C', dest='colours',
type=int,
choices=[1, 16, 256],
@@ -61,6 +64,8 @@ def main():
#read config file
configfilename = os.path.expanduser(args.configfile)
settings.config.read(configfilename)
+ notmuchfile = os.path.expanduser(args.notmuchconfigfile)
+ settings.notmuchconfig.read(notmuchfile)
settings.hooks.setup(settings.config.get('general', 'hooksfile'))
# setup logging
diff --git a/alot/settings.py b/alot/settings.py
index 51a25827..b373016c 100644
--- a/alot/settings.py
+++ b/alot/settings.py
@@ -269,11 +269,16 @@ DEFAULTS = {
}
}
+NOTMUCH_DEFAULTS = {
+ 'maildir': {
+ 'synchronize_flags': 'False',
+ },
+}
-class CustomConfigParser(SafeConfigParser):
+
+class DefaultsConfigParser(SafeConfigParser):
def __init__(self, defaults):
self.defaults = defaults
- self.hooks = None
SafeConfigParser.__init__(self)
self.optionxform = lambda x: x
for sec in defaults.keys():
@@ -299,6 +304,11 @@ class CustomConfigParser(SafeConfigParser):
value = self.get(section, option, **kwargs)
return [s.strip() for s in value.split(',')]
+class AlotConfigParser(DefaultsConfigParser):
+ def __init__(self, defaults):
+ DefaultsConfigParser.__init__(self, defaults)
+ self.hooks = None
+
def read(self, file):
if not os.path.isfile(file):
return
@@ -388,7 +398,8 @@ class HookManager:
return f
-config = CustomConfigParser(DEFAULTS)
+config = AlotConfigParser(DEFAULTS)
+notmuchconfig = DefaultsConfigParser(NOTMUCH_DEFAULTS)
hooks = HookManager()
mailcaps = mailcap.getcaps()