[PATCH] config: read database.path from $MAILDIR if set
Mark Oteiza
mvoteiza at udel.edu
Mon Jul 21 16:05:12 PDT 2014
Try to read the config parameter database.path from $MAILDIR before
falling back to $HOME/mail
---
In the same vein as the $NAME patch, it would also be nice to configure
the maildir location for notmuch with one's environment. Just from a
brief perusing, I see that $MAILDIR is used at least by Gnus, procmail,
GNU mailutils, and mutt.
Another thing that might be nice is tilde expantion for database.path,
but that's more complicated :)
notmuch-config.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/notmuch-config.c b/notmuch-config.c
index 8f1f48d..88831e2 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -217,7 +217,7 @@ get_username_from_passwd_file (void *ctx)
* These default configuration settings are determined as
* follows:
*
- * database_path: $HOME/mail
+ * database_path: $MAILDIR, otherwise $HOME/mail
*
* user_name: $NAME variable if set, otherwise
* read from /etc/passwd
@@ -323,8 +323,10 @@ notmuch_config_open (void *ctx,
if (notmuch_config_get_database_path (config) == NULL) {
- char *path = talloc_asprintf (config, "%s/mail",
- getenv ("HOME"));
+ char *path = getenv ("MAILDIR");
+ if (! path)
+ path = talloc_asprintf (config, "%s/mail",
+ getenv ("HOME"));
notmuch_config_set_database_path (config, path);
talloc_free (path);
}
--
2.0.2
More information about the notmuch
mailing list