unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] cli: looking for config file in $XDG_CONFIG_HOME
@ 2018-03-14 12:43 sh!zeeg
  2018-03-14 12:43 ` [PATCH 2/2] doc: reflect config default location change sh!zeeg
  2018-03-15  0:02 ` [PATCH 1/2] cli: looking for config file in $XDG_CONFIG_HOME Tomi Ollila
  0 siblings, 2 replies; 7+ messages in thread
From: sh!zeeg @ 2018-03-14 12:43 UTC (permalink / raw)
  To: notmuch; +Cc: sh!zeeg

According to XDG Base Directory Specification
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
configuration files should be stored in $XDG_CONFIG_HOME which
defaulted to $HOME/.config/
---
 notmuch-config.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/notmuch-config.c b/notmuch-config.c
index e1b16609..7651c912 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -293,7 +293,7 @@ out:
 /* Open the named notmuch configuration file. If the filename is NULL,
  * the value of the environment variable $NOTMUCH_CONFIG will be used.
  * If $NOTMUCH_CONFIG is unset, the default configuration file
- * ($HOME/.notmuch-config) will be used.
+ * ($XDG_CONFIG_HOME/notmuch/config) will be used.
  *
  * If any error occurs, (out of memory, or a permission-denied error,
  * etc.), this function will print a message to stderr and return
@@ -358,8 +358,10 @@ notmuch_config_open (void *ctx,
 	config->filename = talloc_strdup (config, filename);
     } else if ((notmuch_config_env = getenv ("NOTMUCH_CONFIG"))) {
 	config->filename = talloc_strdup (config, notmuch_config_env);
+    } else if ((notmuch_config_env = getenv ("XDG_CONFIG_HOME"))) {
+	config->filename = talloc_strdup (config, notmuch_config_env);
     } else {
-	config->filename = talloc_asprintf (config, "%s/.notmuch-config",
+	config->filename = talloc_asprintf (config, "%s/.config/notmuch/config",
 					    getenv ("HOME"));
     }
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-04-06 18:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14 12:43 [PATCH 1/2] cli: looking for config file in $XDG_CONFIG_HOME sh!zeeg
2018-03-14 12:43 ` [PATCH 2/2] doc: reflect config default location change sh!zeeg
2018-03-15  0:02 ` [PATCH 1/2] cli: looking for config file in $XDG_CONFIG_HOME Tomi Ollila
2018-03-15  1:54   ` David Bremner
2018-03-15 13:54     ` Daniel Kahn Gillmor
2018-03-19  1:24       ` David Bremner
2018-04-06 18:48       ` Jani Nikula

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).