(setq errtype "access"))
(with-file-modes ?\700
(condition-case nil
- (make-directory user-emacs-directory)
+ (make-directory user-emacs-directory t)
(error (setq errtype "create")))))
(when (and errtype
user-emacs-directory-warning
;; This is typically equivalent to ~/.config/emacs if the user is
;; following the XDG convention, and is ~INIT-FILE-USER/.emacs.d
;; on other systems.
- (setq xdg-dir
- (let* ((dir (concat (or (getenv "XDG_CONFIG_HOME")
+ (setq xdg-dir (concat (or (getenv "XDG_CONFIG_HOME")
(concat "~" init-file-user "/.config"))
- "/emacs/")))
- (if (file-exists-p dir) dir)))
+ "/emacs/"))
(setq startup-init-directory
- (or xdg-dir (concat "~" init-file-user "/.emacs.d/")))
+ (if (file-exists-p xdg-dir)
+ xdg-dir
+ (let ((emacs-d-dir (concat "~" init-file-user "/.emacs.d/")))
+ (if (file-exists-p emacs-d-dir)
+ emacs-d-dir
+ xdg-dir))))
;; Load the early init file, if found.
(startup--load-user-init-file
(startup--load-user-init-file
(lambda ()
(cond
- (xdg-dir nil)
+ ((eq startup-init-directory xdg-dir) nil)
((eq system-type 'ms-dos)
(concat "~" init-file-user "/_emacs"))
((not (eq system-type 'windows-nt))
"/emacs/")))
(if (file-exists-p config-dir)
config-dir
- (if (eq system-type 'ms-dos)
- ;; MS-DOS cannot have initial dot.
- "~/_emacs.d/"
- "~/.emacs.d/")))
+ (let ((emacs-d-dir (if (eq system-type 'ms-dos)
+ ;; MS-DOS cannot have initial dot.
+ "~/_emacs.d/"
+ "~/.emacs.d/")))
+ (if (file-exists-p emacs-d-dir)
+ emacs-d-dir
+ config-dir))))
"Directory beneath which additional per-user Emacs-specific files are placed.
Various programs in Emacs store information in this directory.
Note that this should end with a directory separator.