Reset more state on doom/module initialization

Makes `doom/reload` a little more reliable and the side effects of
`doom-initialize`/`doom-initialize-modules` a little more deterministic.
This commit is contained in:
Henrik Lissner 2019-04-09 03:43:13 -04:00
parent defd60b24b
commit 31eb845f6b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 22 additions and 5 deletions

View file

@ -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.