Optimize package management commands
Effectively halving run time on package install, update and autoremove commands.
This commit is contained in:
parent
c46bd978fc
commit
82f9fb7027
2 changed files with 19 additions and 16 deletions
|
@ -147,7 +147,7 @@ Warning: this function is expensive; it re-evaluates all of doom's config files.
|
||||||
Be careful not to use it in a loop.
|
Be careful not to use it in a loop.
|
||||||
|
|
||||||
If INSTALLED-ONLY-P, only return packages that are installed."
|
If INSTALLED-ONLY-P, only return packages that are installed."
|
||||||
(doom-initialize-packages t)
|
(doom-initialize-packages (not noninteractive))
|
||||||
(cl-loop with packages = (append doom-core-packages (mapcar #'car doom-packages))
|
(cl-loop with packages = (append doom-core-packages (mapcar #'car doom-packages))
|
||||||
for sym in (cl-delete-duplicates packages)
|
for sym in (cl-delete-duplicates packages)
|
||||||
if (and (or (not installed-only-p)
|
if (and (or (not installed-only-p)
|
||||||
|
@ -180,7 +180,7 @@ containing (PACKAGE-SYMBOL OLD-VERSION-LIST NEW-VERSION-LIST).
|
||||||
If INCLUDE-FROZEN-P is non-nil, check frozen packages as well.
|
If INCLUDE-FROZEN-P is non-nil, check frozen packages as well.
|
||||||
|
|
||||||
Used by `doom//packages-update'."
|
Used by `doom//packages-update'."
|
||||||
(doom-initialize-packages t)
|
(doom-initialize-packages (not noninteractive))
|
||||||
(require 'async)
|
(require 'async)
|
||||||
(let (quelpa-pkgs elpa-pkgs)
|
(let (quelpa-pkgs elpa-pkgs)
|
||||||
;; Separate quelpa from elpa packages
|
;; Separate quelpa from elpa packages
|
||||||
|
@ -201,13 +201,17 @@ Used by `doom//packages-update'."
|
||||||
(message "New thread for: %s" pkg))
|
(message "New thread for: %s" pkg))
|
||||||
(push (async-start
|
(push (async-start
|
||||||
`(lambda ()
|
`(lambda ()
|
||||||
(setq user-emacs-directory ,user-emacs-directory)
|
(let ((doom-init-p 'internal)
|
||||||
(let ((noninteractive t))
|
(noninteractive t)
|
||||||
(load ,(expand-file-name "core.el" doom-core-dir)))
|
(load-path ',load-path)
|
||||||
(setq doom-packages ',doom-packages
|
(doom-packages ',doom-packages)
|
||||||
doom-modules ',doom-modules
|
(doom-modules ',doom-modules)
|
||||||
quelpa-cache ',quelpa-cache)
|
(quelpa-cache ',quelpa-cache)
|
||||||
(doom-package-outdated-p ',pkg)))
|
(user-emacs-directory ,user-emacs-directory)
|
||||||
|
doom-private-dir)
|
||||||
|
(load ,(expand-file-name "core.el" doom-core-dir))
|
||||||
|
(load ,(expand-file-name "autoload/packages.el" doom-core-dir))
|
||||||
|
(doom-package-outdated-p ',pkg))))
|
||||||
futures))
|
futures))
|
||||||
(delq nil
|
(delq nil
|
||||||
(append (mapcar #'doom-package-outdated-p elpa-pkgs)
|
(append (mapcar #'doom-package-outdated-p elpa-pkgs)
|
||||||
|
@ -219,7 +223,7 @@ Used by `doom//packages-update'."
|
||||||
depended on.
|
depended on.
|
||||||
|
|
||||||
Used by `doom//packages-autoremove'."
|
Used by `doom//packages-autoremove'."
|
||||||
(doom-initialize-packages t)
|
(doom-initialize-packages (not noninteractive))
|
||||||
(let ((package-selected-packages
|
(let ((package-selected-packages
|
||||||
(append (mapcar #'car doom-packages) doom-core-packages)))
|
(append (mapcar #'car doom-packages) doom-core-packages)))
|
||||||
(append (package--removable-packages)
|
(append (package--removable-packages)
|
||||||
|
@ -239,7 +243,7 @@ If INCLUDE-IGNORED-P is non-nil, includes missing packages that are ignored,
|
||||||
i.e. they have an :ignore property.
|
i.e. they have an :ignore property.
|
||||||
|
|
||||||
Used by `doom//packages-install'."
|
Used by `doom//packages-install'."
|
||||||
(doom-initialize-packages t)
|
(doom-initialize-packages (not noninteractive))
|
||||||
(cl-loop for desc in (doom-get-packages)
|
(cl-loop for desc in (doom-get-packages)
|
||||||
for (name . plist) = desc
|
for (name . plist) = desc
|
||||||
if (and (or include-ignored-p
|
if (and (or include-ignored-p
|
||||||
|
|
|
@ -200,6 +200,8 @@ FORCE-P is non-nil, do it anyway.
|
||||||
(require 'subr-x)
|
(require 'subr-x)
|
||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
(require 'map))
|
(require 'map))
|
||||||
|
(when (eq doom-init-p 'internal)
|
||||||
|
(setq force-p nil))
|
||||||
(when (or force-p (not doom-init-p))
|
(when (or force-p (not doom-init-p))
|
||||||
;; packages.el cache
|
;; packages.el cache
|
||||||
(when (and force-p (file-exists-p doom-packages-file))
|
(when (and force-p (file-exists-p doom-packages-file))
|
||||||
|
@ -316,12 +318,9 @@ them."
|
||||||
(_load (expand-file-name "packages.el" doom-core-dir))
|
(_load (expand-file-name "packages.el" doom-core-dir))
|
||||||
(cl-loop for key being the hash-keys of doom-modules
|
(cl-loop for key being the hash-keys of doom-modules
|
||||||
for path = (doom-module-expand-file (car key) (cdr key) "packages.el")
|
for path = (doom-module-expand-file (car key) (cdr key) "packages.el")
|
||||||
if (file-exists-p path)
|
do (let ((doom--current-module key)) (_load path t)))
|
||||||
do (let ((doom--current-module key)) (_load path)))
|
|
||||||
(cl-loop for dir in doom-psuedo-module-dirs
|
(cl-loop for dir in doom-psuedo-module-dirs
|
||||||
for path = (expand-file-name "packages.el" dir)
|
do (_load (expand-file-name "packages.el" dir) t))))))))
|
||||||
if (file-exists-p path)
|
|
||||||
do (_load path))))))))
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue