aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorRobert Pluim2020-01-15 12:24:43 +0100
committerRobert Pluim2020-01-16 16:05:45 +0100
commit13995f31a219bfcb24da5887136583cbf2deff4c (patch)
treeb8abcb0057271c7ed2d6d90144c6925beaaea128 /lib-src
parent91cac24952806c6c4addc3c045854c2c314c2e31 (diff)
downloademacs-13995f31a219bfcb24da5887136583cbf2deff4c.tar.gz
emacs-13995f31a219bfcb24da5887136583cbf2deff4c.zip
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)
924 char *configname = xmalloc (max (xdgsubdirsize, homesubdirsizemax) 924 char *configname = xmalloc (max (xdgsubdirsize, homesubdirsizemax)
925 + strlen (config_file)); 925 + strlen (config_file));
926 FILE *config; 926 FILE *config;
927 if (xdg || home) 927
928 if (home)
928 { 929 {
929 strcpy ((xdg 930 strcpy (stpcpy (stpcpy (configname, home), "/.emacs.d/server/"),
930 ? stpcpy (stpcpy (configname, xdg), "/emacs/server/") 931 config_file);
931 : stpcpy (stpcpy (configname, home), "/.config/emacs/server/")),
932 config_file);
933 config = fopen (configname, "rb"); 932 config = fopen (configname, "rb");
934 } 933 }
935 else 934 else
936 config = NULL; 935 config = NULL;
937 936
938 if (! config && home) 937 if (! config && (xdg || home))
939 { 938 {
940 strcpy (stpcpy (stpcpy (configname, home), "/.emacs.d/server/"), 939 strcpy ((xdg
941 config_file); 940 ? stpcpy (stpcpy (configname, xdg), "/emacs/server/")
941 : stpcpy (stpcpy (configname, home), "/.config/emacs/server/")),
942 config_file);
942 config = fopen (configname, "rb"); 943 config = fopen (configname, "rb");
943 } 944 }
944 945