Fix doom/recompile (and doom-initialize-packages)
This commit is contained in:
parent
b447f30038
commit
9bd270b375
1 changed files with 34 additions and 14 deletions
|
@ -145,18 +145,31 @@ to speed up startup."
|
||||||
(unless (file-exists-p doom-autoload-file)
|
(unless (file-exists-p doom-autoload-file)
|
||||||
(error "Autoloads file couldn't be generated")))))
|
(error "Autoloads file couldn't be generated")))))
|
||||||
|
|
||||||
(defun doom-initialize-packages (&optional force-p)
|
(defun doom-initialize-packages (&optional force-p load-p)
|
||||||
"Executes the packages.el files across DOOM Emacs to refresh `doom-modules'
|
"Loads the packages.el files across DOOM Emacs in order to fill `doom-modules'
|
||||||
and `doom-packages'."
|
and `doom-packages', if they aren't set already. If FORCE-P is non-nil, do it
|
||||||
|
even if they are."
|
||||||
(doom-initialize force-p)
|
(doom-initialize force-p)
|
||||||
(when (or force-p (not doom-modules) (not doom-packages))
|
(let ((noninteractive t)
|
||||||
(setq doom-modules nil
|
(load-fn
|
||||||
doom-packages nil)
|
(lambda (file &optional noerror)
|
||||||
(let ((noninteractive t))
|
(condition-case ex
|
||||||
(mapc (lambda (file) (load file nil :nomessage))
|
(load file noerror :nomessage :nosuffix)
|
||||||
(list (f-expand "packages.el" doom-core-dir)
|
('error (message "INIT-PACKAGES ERROR (%s): %s" file ex))))))
|
||||||
(f-expand "init.el" doom-emacs-dir)))
|
(when (or force-p (not doom-modules))
|
||||||
(mapc (lambda (file) (load file :noerror :nomessage))
|
(setq doom-modules nil)
|
||||||
|
(funcall load-fn (f-expand "init.el" doom-emacs-dir))
|
||||||
|
(when load-p
|
||||||
|
(mapc (lambda (file) (funcall load-fn file t))
|
||||||
|
(append (reverse (f-glob "core*.el" doom-core-dir))
|
||||||
|
(f-glob "autoload/*.el" doom-core-dir)
|
||||||
|
(--map (doom-module-path (car it) (cdr it) "config.el")
|
||||||
|
(doom--module-pairs))))))
|
||||||
|
|
||||||
|
(when (or force-p (not doom-packages))
|
||||||
|
(setq doom-packages nil)
|
||||||
|
(funcall load-fn (f-expand "packages.el" doom-core-dir))
|
||||||
|
(mapc (lambda (file) (funcall load-fn file t))
|
||||||
(--map (doom-module-path (car it) (cdr it) "packages.el")
|
(--map (doom-module-path (car it) (cdr it) "packages.el")
|
||||||
(doom--module-pairs))))))
|
(doom--module-pairs))))))
|
||||||
|
|
||||||
|
@ -253,7 +266,7 @@ as a symbol. PATH is a directory to prefix it with. If NOERROR is non-nil, don't
|
||||||
throw an error if the file doesn't exist.
|
throw an error if the file doesn't exist.
|
||||||
|
|
||||||
Sets `__FILE__' and `__DIR__' on the loaded file."
|
Sets `__FILE__' and `__DIR__' on the loaded file."
|
||||||
(let ((path (or (and path (eval path)) __DIR__)))
|
(let ((path (or (and path (eval path)) (__DIR__))))
|
||||||
(unless path
|
(unless path
|
||||||
(error "Could not find %s" filesym))
|
(error "Could not find %s" filesym))
|
||||||
(let ((file (f-expand (concat (symbol-name filesym) ".el") path)))
|
(let ((file (f-expand (concat (symbol-name filesym) ".el") path)))
|
||||||
|
@ -365,15 +378,22 @@ core/*.el). DOOM Emacs was designed to benefit from this.
|
||||||
If SIMPLE-P is nil, also byte-compile modules/*/*/*.el (except for packages.el).
|
If SIMPLE-P is nil, also byte-compile modules/*/*/*.el (except for packages.el).
|
||||||
There should be a measurable benefit from this, but it may take a while."
|
There should be a measurable benefit from this, but it may take a while."
|
||||||
(interactive)
|
(interactive)
|
||||||
(doom-initialize-packages t)
|
;; Ensure all relevant config files are loaded. This way we don't need
|
||||||
|
;; eval-when-compile and require blocks scattered all over.
|
||||||
|
(doom-initialize-packages t noninteractive)
|
||||||
(let ((targets
|
(let ((targets
|
||||||
(append (list (f-expand "init.el" doom-emacs-dir)
|
(append (list (f-expand "init.el" doom-emacs-dir)
|
||||||
(f-expand "core.el" doom-core-dir))
|
(f-expand "core.el" doom-core-dir))
|
||||||
(f-glob "core-*.el" doom-core-dir)
|
(f-glob "core-*.el" doom-core-dir)
|
||||||
|
(f-glob "autoload/*.el" doom-core-dir)
|
||||||
(unless simple-p
|
(unless simple-p
|
||||||
(-flatten
|
(-flatten
|
||||||
(--map (f--entries (doom-module-path (car it) (cdr it))
|
(--map (f--entries (doom-module-path (car it) (cdr it))
|
||||||
(f-ext-p it "el") t)
|
(and (f-ext-p it "el")
|
||||||
|
(let ((fname (f-filename it)))
|
||||||
|
(or (string= fname "config.el")
|
||||||
|
(s-prefix-p "+" fname t))))
|
||||||
|
t)
|
||||||
(doom--module-pairs))))))
|
(doom--module-pairs))))))
|
||||||
(n 0)
|
(n 0)
|
||||||
results)
|
results)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue