Fix package! :disable not disabling packages

doom-disabled-packages we built either too early or too late, causing
disabled packages to be loaded anyway.
This commit is contained in:
Henrik Lissner 2018-03-28 02:56:21 -04:00
parent 05d4386409
commit 4bafe29722
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -83,9 +83,10 @@ missing) and shouldn't be deleted.")
(defvar doom-packages-file (concat doom-local-dir "packages.el") (defvar doom-packages-file (concat doom-local-dir "packages.el")
"Where to cache `load-path' and `Info-directory-list'.") "Where to cache `load-path' and `Info-directory-list'.")
(defvar doom--refreshed-p nil)
(defvar doom--current-module nil) (defvar doom--current-module nil)
(defvar doom--init-cache-p nil)
(defvar doom--initializing nil) (defvar doom--initializing nil)
(defvar doom--refreshed-p nil)
(defvar generated-autoload-load-name) (defvar generated-autoload-load-name)
(setq autoload-compute-prefixes nil (setq autoload-compute-prefixes nil
@ -139,14 +140,16 @@ missing) and shouldn't be deleted.")
(defun doom--refresh-cache () (defun doom--refresh-cache ()
"TODO" "TODO"
(doom-initialize-packages 'internal) (when doom--init-cache-p
(unless noninteractive (doom-initialize-packages 'internal)
(with-temp-buffer (unless noninteractive
(prin1 `(setq load-path ',load-path (with-temp-buffer
Info-directory-list ',Info-directory-list (prin1 `(setq load-path ',load-path
doom-disabled-packages ',doom-disabled-packages) Info-directory-list ',Info-directory-list
(current-buffer)) doom-disabled-packages ',doom-disabled-packages)
(write-file doom-packages-file)))) (current-buffer))
(write-file doom-packages-file))
(setq doom--init-cache-p nil))))
(defun doom-initialize (&optional force-p) (defun doom-initialize (&optional force-p)
"Bootstrap the bare essentials to get Doom running, if it hasn't already. If "Bootstrap the bare essentials to get Doom running, if it hasn't already. If
@ -195,7 +198,7 @@ FORCE-P is non-nil, do it anyway.
(error "✕ Couldn't install %s" package))) (error "✕ Couldn't install %s" package)))
(message "Installing core packages...done"))) (message "Installing core packages...done")))
(cl-pushnew doom-core-dir load-path :test #'string=) (cl-pushnew doom-core-dir load-path :test #'string=)
(add-hook 'after-init-hook #'doom--refresh-cache)) (setq doom--init-cache-p t))
(setq doom-init-p t))) (setq doom-init-p t)))
(defun doom-initialize-autoloads () (defun doom-initialize-autoloads ()
@ -388,6 +391,7 @@ MODULES is an malformed plist of modules to load."
,@(nreverse load-forms)) ,@(nreverse load-forms))
,(unless doom--initializing ,(unless doom--initializing
'(unless noninteractive '(unless noninteractive
(doom--refresh-cache)
(doom-initialize-modules)))))) (doom-initialize-modules))))))
(defmacro def-package! (name &rest plist) (defmacro def-package! (name &rest plist)