From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 063C0431FBD for ; Mon, 21 Jul 2014 16:05:37 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yVd8jKPG4l9B for ; Mon, 21 Jul 2014 16:05:31 -0700 (PDT) Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 61F22431FAE for ; Mon, 21 Jul 2014 16:05:31 -0700 (PDT) Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1X9Me7-0001HG-Pz for notmuch@notmuchmail.org; Tue, 22 Jul 2014 01:05:27 +0200 Received: from ip68-100-203-36.dc.dc.cox.net ([68.100.203.36]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 22 Jul 2014 01:05:27 +0200 Received: from mvoteiza by ip68-100-203-36.dc.dc.cox.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 22 Jul 2014 01:05:27 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: notmuch@notmuchmail.org From: Mark Oteiza Subject: [PATCH] config: read database.path from $MAILDIR if set Date: Mon, 21 Jul 2014 19:05:12 -0400 Message-ID: <87ha2axqhj.fsf@holos.localdomain> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ip68-100-203-36.dc.dc.cox.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:tX6Aitr2+MsK2fejcqcXjvwc33E= X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jul 2014 23:05:37 -0000 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