diff --git a/core/autoload/config.el b/core/autoload/config.el index 2e00de8ff..2c61d176e 100644 --- a/core/autoload/config.el +++ b/core/autoload/config.el @@ -33,11 +33,11 @@ Runs `doom-reload-hook' afterwards." (when (getenv "DOOMENV") (doom-reload-env-file 'force)) (doom-reload-autoloads force-p) - (setq load-path doom-site-load-path) (let (doom-init-p) (doom-initialize)) (with-demoted-errors "PRIVATE CONFIG ERROR: %s" - (doom-initialize-modules 'force)) + (let (doom-init-modules-p) + (doom-initialize-modules))) (when (bound-and-true-p doom-packages) (doom/reload-packages)) (run-hook-wrapped 'doom-reload-hook #'doom-try-run-hook)) diff --git a/core/core-modules.el b/core/core-modules.el index f2185c66d..75d6ed623 100644 --- a/core/core-modules.el +++ b/core/core-modules.el @@ -59,6 +59,7 @@ session of Dooming. Will noop if used more than once, unless FORCE-P is non-nil." (when (and (or force-p (not doom-init-modules-p)) + (not (setq doom-modules nil)) (load! "init" doom-private-dir t)) (setq doom-init-modules-p t) (maphash (lambda (key plist) diff --git a/core/core.el b/core/core.el index 0dc7a8f4a..e9a797283 100644 --- a/core/core.el +++ b/core/core.el @@ -98,11 +98,21 @@ MacOS users).") "If non-nil, the running version of Emacs is different from the first time Doom was setup, which can cause problems.") -(defvar doom-site-load-path load-path - "The starting `load-path', before it is altered by `doom-initialize'.") +(defvar doom-site-load-path (cons doom-core-dir load-path) + "The initial value of `load-path', before it was altered by +`doom-initialize'.") (defvar doom-site-process-environment process-environment - "The starting `process-environment', before it is altered by `doom-initialize'.") + "The initial value of `process-environment', before it was altered by +`doom-initialize'.") + +(defvar doom-site-exec-path exec-path + "The initial value of `exec-path', before it was altered by +`doom-initialize'.") + +(defvar doom-site-shell-file-name shell-file-name + "The initial value of `shell-file-name', before it was altered by +`doom-initialize'.") (defvar doom--last-emacs-file (concat doom-local-dir "emacs-version.el")) (defvar doom--last-emacs-version nil) @@ -431,6 +441,12 @@ to least)." (when (or force-p (not doom-init-p)) (setq doom-init-p t) ; Prevent infinite recursion + ;; Reset as much state as possible + (setq exec-path doom-site-exec-path + load-path doom-site-load-path + process-environment doom-site-process-environment + shell-file-name doom-site-shell-file-name) + ;; `doom-autoload-file' tells Emacs where to load all its autoloaded ;; functions from. This includes everything in core/autoload/*.el and all ;; the autoload files in your enabled modules.