summaryrefslogtreecommitdiff
path: root/alot/settings
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2012-07-31 21:34:49 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2012-08-01 07:56:12 +0100
commit21d106c1dfb0c1ef7c743490178d1b7447b2b7c9 (patch)
treef4c1b54b11c7aff71177e5bba97c408238500182 /alot/settings
parent8bcd5560af59e2476272e64559d7461ec7247342 (diff)
read default bindings from default/default.bindings
This re-introduces a separate file containing the default keybindings for alot. The values from this file are *always* used as fallbacks and can be overwritten by bindings from the users config. To be able to unbind a default binding just bind it to an empty string. The same will allow buffer-local bindings to be overwritten by global bindings as described in https://github.com/pazz/alot/issues/403#issuecomment-4434948. cf issue #487
Diffstat (limited to 'alot/settings')
-rw-r--r--alot/settings/__init__.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/alot/settings/__init__.py b/alot/settings/__init__.py
index 0edfc24c..35599fa8 100644
--- a/alot/settings/__init__.py
+++ b/alot/settings/__init__.py
@@ -44,8 +44,8 @@ class SettingsManager(object):
theme_path = theme or os.path.join(DEFAULTSPATH, 'default.theme')
self._theme = Theme(theme_path)
- self._bindings = ConfigObj()
-
+ bindings_path = os.path.join(DEFAULTSPATH, 'default.bindings')
+ self._bindings = ConfigObj(bindings_path)
self._config = ConfigObj()
self._accounts = None
self._accountmap = None
@@ -331,7 +331,9 @@ class SettingsManager(object):
cmdline = bindings[key]
if mode in bindings.sections:
if key in bindings[mode].scalars:
- cmdline = bindings[mode][key]
+ value = bindings[mode][key]
+ if value:
+ cmdline = value
return cmdline
def get_accounts(self):