fix: premature doom init in doom sub-profiles

Ensures that Doom doesn't prematurely initialize itself if a non-Doom
config tries to load Doom.
This commit is contained in:
Henrik Lissner 2022-08-02 20:22:31 +02:00
parent 2d53fe6123
commit 3a5e34d67b
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -132,8 +132,11 @@
;;
;;; Bootstrap
(let (init-file)
;; Load the heart of Doom Emacs
(unless (require 'doom (expand-file-name "lisp/doom" user-emacs-directory) t)
(if (require 'doom (expand-file-name "lisp/doom" user-emacs-directory) t)
;; ...and prepare for an interactive session.
(setq init-file (expand-file-name "doom-start" doom-core-dir))
;; ...but if that fails, then this is likely not a Doom config.
(setq early-init-file (expand-file-name "early-init" user-emacs-directory))
(load early-init-file t (not init-file-debug)))
@ -157,12 +160,11 @@
(define-advice startup--load-user-init-file (:filter-args (args) init-doom)
"Initialize Doom Emacs in an interactive session."
(list (lambda ()
(if (boundp 'doom-core-dir)
(expand-file-name "doom-start" doom-core-dir)
(or init-file
(expand-file-name "init.el" user-emacs-directory)))
(when (boundp 'doom-profiles-dir)
(lambda ()
(expand-file-name "safe-mode@static/init.el" doom-profiles-dir)))
(caddr args)))
(caddr args))))
;;; early-init.el ends here