Insert package state before package autoloads in autoloads file
Prevents issues where autoloads will try to load packages but `load-path` isn't initialized yet, causing "Cannot open load file" errors.
This commit is contained in:
parent
0bdf638813
commit
0aa7bf2d4a
1 changed files with 13 additions and 12 deletions
|
@ -208,8 +208,18 @@ This should be run whenever your `doom!' block or update your packages."
|
|||
(with-temp-file doom-package-autoload-file
|
||||
(insert ";;; -*- lexical-binding:t -*-\n"
|
||||
";; This file is autogenerated by `doom//reload-package-autoloads', DO NOT EDIT !!\n\n")
|
||||
;; insert package autoloads
|
||||
(save-excursion
|
||||
;; Cache the important and expensive-to-initialize state here.
|
||||
(doom-initialize-packages 'internal)
|
||||
(prin1 `(setq load-path ',load-path
|
||||
auto-mode-alist ',auto-mode-alist
|
||||
Info-directory-list ',Info-directory-list
|
||||
doom-disabled-packages ',doom-disabled-packages
|
||||
package-activated-list ',package-activated-list)
|
||||
(current-buffer))
|
||||
(print! (green "✓ Cached package state"))
|
||||
|
||||
;; insert package autoloads
|
||||
(dolist (spec package-alist)
|
||||
(cl-destructuring-bind (pkg desc) spec
|
||||
(unless (memq pkg doom-autoload-excluded-packages)
|
||||
|
@ -223,17 +233,8 @@ This should be run whenever your `doom!' block or update your packages."
|
|||
(unless (nth 8 (syntax-ppss))
|
||||
(replace-match "" t t)))
|
||||
(unless (bolp) (insert "\n"))
|
||||
(insert ")\n"))))))
|
||||
(print! (green "✓ Package autoloads included"))
|
||||
;; Cache the important and expensive-to-initialize state here.
|
||||
(doom-initialize-packages 'internal)
|
||||
(prin1 `(setq load-path ',load-path
|
||||
auto-mode-alist ',auto-mode-alist
|
||||
Info-directory-list ',Info-directory-list
|
||||
doom-disabled-packages ',doom-disabled-packages
|
||||
package-activated-list ',package-activated-list)
|
||||
(current-buffer))
|
||||
(print! (green "✓ Cached package state")))
|
||||
(insert ")\n")))))))
|
||||
(print! (green "✓ Package autoloads included"))
|
||||
;; Remove `load-path' and `auto-mode-alist' modifications (most of them,
|
||||
;; at least); they are cached later, so all those membership checks are
|
||||
;; unnecessary overhead.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue