summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorRobert Pluim <rpluim@gmail.com>2020-01-15 12:24:43 +0100
committerRobert Pluim <rpluim@gmail.com>2020-01-16 16:05:45 +0100
commit13995f31a219bfcb24da5887136583cbf2deff4c (patch)
treeb8abcb0057271c7ed2d6d90144c6925beaaea128 /lib-src
parent91cac24952806c6c4addc3c045854c2c314c2e31 (diff)
downloademacs-13995f31a219bfcb24da5887136583cbf2deff4c.tar.gz
Make emacs prefer an existing ~/.emacs.d to an existing XDG location
* doc/emacs/custom.texi (Find Init): Update description of how Emacs finds its init file directory and the interaction with $XDG_CONFIG_HOME (Early Init File): Correct XDG location of early-init.el * etc/NEWS: Update description to make it clear the ~/.emacs.d is preferred, even if the XDG location exists. * lisp/startup.el: Prefer ~/.emacs.d even if the XDG location exists. * lib-src/emacsclient.c (open_config): Prefer home directory the XDG location.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsclient.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 645ff04c6d4..204064f1871 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -924,21 +924,22 @@ open_config (char const *home, char const *xdg, char const *config_file)
char *configname = xmalloc (max (xdgsubdirsize, homesubdirsizemax)
+ strlen (config_file));
FILE *config;
- if (xdg || home)
+
+ if (home)
{
- strcpy ((xdg
- ? stpcpy (stpcpy (configname, xdg), "/emacs/server/")
- : stpcpy (stpcpy (configname, home), "/.config/emacs/server/")),
- config_file);
+ strcpy (stpcpy (stpcpy (configname, home), "/.emacs.d/server/"),
+ config_file);
config = fopen (configname, "rb");
}
else
config = NULL;
- if (! config && home)
+ if (! config && (xdg || home))
{
- strcpy (stpcpy (stpcpy (configname, home), "/.emacs.d/server/"),
- config_file);
+ strcpy ((xdg
+ ? stpcpy (stpcpy (configname, xdg), "/emacs/server/")
+ : stpcpy (stpcpy (configname, home), "/.config/emacs/server/")),
+ config_file);
config = fopen (configname, "rb");
}