unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: sh!zeeg <shizeeque@gmail.com>, notmuch@notmuchmail.org
Subject: Re: [PATCH 1/2] cli: looking for config file in $XDG_CONFIG_HOME
Date: Thu, 15 Mar 2018 02:02:34 +0200	[thread overview]
Message-ID: <m2muzap5np.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <20180314124321.13848-1-shizeeque@gmail.com>

On Wed, Mar 14 2018, shizeeque@gmail.com wrote:

> 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/

Interesting stuff -- IIRC we tried something like this like 5 years ago
... and now we've been discussing about other options ...

Anyway, this would break status quo and current users' environments,
and secondly it looks like all fails unless this /notmuch/ directory
in XDG_CONFIG_HOME / ~/.config exists.

Tomi


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

  parent reply	other threads:[~2018-03-15  0:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Tomi Ollila [this message]
2018-03-15  1:54   ` [PATCH 1/2] cli: looking for config file in $XDG_CONFIG_HOME David Bremner
2018-03-15 13:54     ` Daniel Kahn Gillmor
2018-03-19  1:24       ` David Bremner
2018-04-06 18:48       ` Jani Nikula

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=m2muzap5np.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=notmuch@notmuchmail.org \
    --cc=shizeeque@gmail.com \
    /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).