unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: notmuch@notmuchmail.org
Subject: [PATCH] config: read database.path from $MAILDIR if set
Date: Mon, 21 Jul 2014 19:05:12 -0400	[thread overview]
Message-ID: <87ha2axqhj.fsf@holos.localdomain> (raw)


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

             reply	other threads:[~2014-07-21 23:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-21 23:05 Mark Oteiza [this message]
2014-07-31 10:10 ` [PATCH] config: read database.path from $MAILDIR if set David Bremner
2014-07-31 10:14   ` David Bremner
2014-07-31 10:17 ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ha2axqhj.fsf@holos.localdomain \
    --to=mvoteiza@udel.edu \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).