Skip to content

Commit 7aa87eb

Browse files
committed
fix(profiles): not loading $EMACSDIR/init.el
`startup--load-user-init-file` persists its original user-emacs-directory in a lexical binding that we cannot affect from early-init.el, and uses it to find init.el. This prevents non-Doom profiles' init.el files from being loaded. A way around this is to have our own $EMACSDIR/init.el that loads {user-emacs-directory}/init.el, but that's unnecessary work and ruins our users' ability to use their $EMACSDIR as their $DOOMDIR, so I opted for advice instead, to force it to recognize the changed user-emacs-directory. Fix: https://discourse.doomemacs.org/t/3251
1 parent d8d0639 commit 7aa87eb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

early-init.el

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,13 @@
111111
nil (not init-file-debug) nil 'must-suffix)
112112
;; Failing that, assume that we're loading a non-Doom config.
113113
(file-missing
114+
;; HACK: `startup--load-user-init-file' resolves $EMACSDIR from a
115+
;; lexically bound `startup-init-directory', which means changes
116+
;; to `user-emacs-directory' won't be respected when loading
117+
;; $EMACSDIR/init.el, so I force it to:
118+
(define-advice startup--load-user-init-file (:filter-args (args) reroute-to-profile)
119+
(list (lambda () (expand-file-name "init.el" user-emacs-directory))
120+
nil (nth 2 args)))
114121
;; Set `user-init-file' for the `load' call further below, and do so
115122
;; here while our `file-name-handler-alist' optimization is still
116123
;; effective (benefits `expand-file-name'). BTW: Emacs resets

0 commit comments

Comments
 (0)