diff options
| author | Robert Pluim | 2020-01-15 12:24:43 +0100 |
|---|---|---|
| committer | Robert Pluim | 2020-01-16 16:05:45 +0100 |
| commit | 13995f31a219bfcb24da5887136583cbf2deff4c (patch) | |
| tree | b8abcb0057271c7ed2d6d90144c6925beaaea128 /lisp | |
| parent | 91cac24952806c6c4addc3c045854c2c314c2e31 (diff) | |
| download | emacs-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 'lisp')
| -rw-r--r-- | lisp/startup.el | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index 2a85c004da1..1f545c66922 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -497,28 +497,28 @@ DIRS are relative." | |||
| 497 | (defvar startup--xdg-config-home-emacs) | 497 | (defvar startup--xdg-config-home-emacs) |
| 498 | 498 | ||
| 499 | ;; Return the name of the init file directory for Emacs, assuming | 499 | ;; Return the name of the init file directory for Emacs, assuming |
| 500 | ;; XDG-DIR is the XDG location and USER-NAME is the user name. | 500 | ;; XDG-DIR is the XDG location and USER-NAME is the user name. If |
| 501 | ;; If USER-NAME is nil or "", use the current user. | 501 | ;; USER-NAME is nil or "", use the current user. Prefer the XDG |
| 502 | ;; Prefer the XDG location unless it does does not exist and the | 502 | ;; location only if the .emacs.d location does not exist. |
| 503 | ;; .emacs.d location does exist. | ||
| 504 | (defun startup--xdg-or-homedot (xdg-dir user-name) | 503 | (defun startup--xdg-or-homedot (xdg-dir user-name) |
| 505 | (if (file-exists-p xdg-dir) | 504 | (let ((emacs-d-dir (concat "~" user-name |
| 506 | xdg-dir | 505 | (if (eq system-type 'ms-dos) |
| 507 | (let ((emacs-d-dir (concat "~" user-name | 506 | "/_emacs.d/" |
| 508 | (if (eq system-type 'ms-dos) | 507 | "/.emacs.d/")))) |
| 509 | "/_emacs.d/" | 508 | (cond |
| 510 | "/.emacs.d/")))) | 509 | ((or (file-exists-p emacs-d-dir) |
| 511 | (if (or (file-exists-p emacs-d-dir) | 510 | (if (eq system-type 'windows-nt) |
| 512 | (if (eq system-type 'windows-nt) | 511 | (if (file-directory-p (concat "~" user-name)) |
| 513 | (if (file-directory-p (concat "~" user-name)) | 512 | (directory-files (concat "~" user-name) nil |
| 514 | (directory-files (concat "~" user-name) nil | 513 | "\\`[._]emacs\\(\\.elc?\\)?\\'")) |
| 515 | "\\`[._]emacs\\(\\.elc?\\)?\\'")) | 514 | (file-exists-p (concat "~" init-file-user |
| 516 | (file-exists-p (concat "~" init-file-user | 515 | (if (eq system-type 'ms-dos) |
| 517 | (if (eq system-type 'ms-dos) | 516 | "/_emacs" |
| 518 | "/_emacs" | 517 | "/.emacs"))))) |
| 519 | "/.emacs"))))) | 518 | emacs-d-dir) |
| 520 | emacs-d-dir | 519 | ((file-exists-p xdg-dir) |
| 521 | xdg-dir)))) | 520 | xdg-dir) |
| 521 | (t emacs-d-dir)))) | ||
| 522 | 522 | ||
| 523 | (defun normal-top-level () | 523 | (defun normal-top-level () |
| 524 | "Emacs calls this function when it first starts up. | 524 | "Emacs calls this function when it first starts up. |