Cache doom-modules on doom refresh

This commit is contained in:
Henrik Lissner 2019-07-07 14:10:21 +02:00
parent b58b5e1d64
commit 71d505b893
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 42 additions and 36 deletions

View file

@ -148,7 +148,7 @@ markdown and copies it to your clipboard, ready to be pasted into bug reports!"
package-user-dir ,package-user-dir
package-archives ',package-archives
user-emacs-directory ,doom-emacs-dir
doom-modules-cache nil)
doom--modules-cache nil)
(with-eval-after-load 'undo-tree
;; undo-tree throws errors because `buffer-undo-tree' isn't
;; corrrectly initialized

View file

@ -274,6 +274,7 @@ Run this whenever your `doom!' block, or a module autoload file, is modified."
(make-directory (file-name-directory doom-autoload-file) t)
(with-temp-file doom-autoload-file
(doom--generate-header 'doom-reload-doom-autoloads)
(prin1 `(setq doom--modules-cache ',doom-modules) (current-buffer))
(save-excursion
(doom--generate-autoloads (reverse enabled-targets)))
;; Replace autoload paths (only for module autoloads) with absolute

View file

@ -52,6 +52,7 @@ your `doom!' block, a warning is emitted before replacing it with :emacs vc and
(defvar doom--current-module nil)
(defvar doom--current-flags nil)
(defvar doom--modules-cache ())
;;
@ -334,6 +335,10 @@ The overall load order of Doom is as follows:
Module load order is determined by your `doom!' block. See `doom-modules-dirs'
for a list of all recognized module trees. Order defines precedence (from most
to least)."
(if doom--modules-cache
(progn
(setq doom-modules doom--modules-cache)
(doom-log "Using `doom-modules' cache"))
(unless doom-modules
(setq doom-modules
(make-hash-table :test 'equal
@ -366,9 +371,9 @@ to least)."
modules)
(push (car key) modules))
(throw 'doom-modules t))))
(if-let* ((path (doom-module-locate-path category module)))
(if-let (path (doom-module-locate-path category module))
(doom-module-set category module :flags flags :path path)
(message "WARNING Couldn't find the %s %s module" category module))))))))
(message "WARNING Couldn't find the %s %s module" category module)))))))))
(when noninteractive
(setq doom-inhibit-module-warnings t))
`(setq doom-modules ',doom-modules))