summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglacambre <code@lacamb.re>2018-12-15 06:24:49 +0100
committerGaute Hope <eg@gaute.vetsj.com>2018-12-15 10:59:29 +0100
commit28f33ca6afadf08fb07787e738f848d2a51afe96 (patch)
tree07dca571313999c5732c9c14d618bea7c96ec957
parent1315ba49803fdc6c943de6fd70bb1a6ed09b832f (diff)
config.cc: Default astroid.notmuch_config to $NOTMUCH_CONFIG
By default, notmuch uses the $NOTMUCH_CONFIG environment variable in order to find its config file. This commit makes astroid's default config generator use this variable in order to populate the astroid.notmuch_config setting.
-rw-r--r--src/config.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/config.cc b/src/config.cc
index f448ce9..3830ace 100644
--- a/src/config.cc
+++ b/src/config.cc
@@ -156,7 +156,12 @@ namespace Astroid {
ptree Config::setup_default_config (bool initial) {
ptree default_config;
default_config.put ("astroid.config.version", CONFIG_VERSION);
+
std::string nm_cfg = path(std_paths.home / path (".notmuch-config")).string();
+ char* nm_env = getenv("NOTMUCH_CONFIG");
+ if (nm_env != NULL) {
+ nm_cfg.assign(nm_env, strlen(nm_env));
+ }
default_config.put ("astroid.notmuch_config" , nm_cfg);
default_config.put ("astroid.debug.dryrun_sending", false);