From 7aa87eb019ed302a1f6f26fe678e139b645aaaab Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 2 Oct 2022 18:06:58 +0200 Subject: [PATCH] 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 --- early-init.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/early-init.el b/early-init.el index 187c646ad..c6e6b4d68 100644 --- a/early-init.el +++ b/early-init.el @@ -111,6 +111,13 @@ nil (not init-file-debug) nil 'must-suffix) ;; Failing that, assume that we're loading a non-Doom config. (file-missing + ;; HACK: `startup--load-user-init-file' resolves $EMACSDIR from a + ;; lexically bound `startup-init-directory', which means changes + ;; to `user-emacs-directory' won't be respected when loading + ;; $EMACSDIR/init.el, so I force it to: + (define-advice startup--load-user-init-file (:filter-args (args) reroute-to-profile) + (list (lambda () (expand-file-name "init.el" user-emacs-directory)) + nil (nth 2 args))) ;; Set `user-init-file' for the `load' call further below, and do so ;; here while our `file-name-handler-alist' optimization is still ;; effective (benefits `expand-file-name'). BTW: Emacs resets