Initialize more straight state in doom-initialize-packages

May address #3172 and some issues with certain files failing to
byte-compile because certain dependencies were missing at compile-time.
This commit is contained in:
Henrik Lissner 2020-12-11 02:12:56 -05:00
parent 96d7e50f3e
commit 2c646df027
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -187,28 +187,34 @@ processed."
(error "Failed to initialize package.el")))
(when (or force-p (null doom-packages))
(doom-log "Initializing straight.el")
(or (setq doom-disabled-packages nil
doom-packages (doom-package-list))
(error "Failed to read any packages"))
(dolist (package doom-packages)
(cl-destructuring-bind
(name &key recipe disable ignore shadow &allow-other-keys) package
(unless ignore
(if disable
(cl-pushnew name doom-disabled-packages)
(when shadow
(straight-override-recipe (cons shadow '(:local-repo nil)))
(let ((site-load-path (copy-sequence doom--initial-load-path))
lib)
(while (setq
lib (locate-library (concat (symbol-name shadow) ".el")
nil site-load-path))
(let ((lib (directory-file-name (file-name-directory lib))))
(setq site-load-path (delete lib site-load-path)
load-path (delete lib load-path))))))
(when recipe
(straight-override-recipe (cons name recipe)))
(straight-register-package name)))))))
(setq doom-disabled-packages nil
doom-packages (doom-package-list))
(let (loaded)
(dolist (package doom-packages)
(cl-destructuring-bind
(name &key recipe disable ignore shadow &allow-other-keys) package
(unless ignore
(if disable
(cl-pushnew name doom-disabled-packages)
(when shadow
(straight-override-recipe (cons shadow '(:local-repo nil)))
(let ((site-load-path (copy-sequence doom--initial-load-path))
lib)
(while (setq
lib (locate-library (concat (symbol-name shadow) ".el")
nil site-load-path))
(let ((lib (directory-file-name (file-name-directory lib))))
(setq site-load-path (delete lib site-load-path)
load-path (delete lib load-path))))))
(when recipe
(straight-override-recipe (cons name recipe)))
(dolist (pkg (cons name (straight--get-dependencies name)))
(unless (memq pkg loaded)
(push pkg loaded)
(straight-register-package pkg)
(let ((pkg-name (symbol-name pkg)))
(add-to-list 'load-path (directory-file-name (straight--build-dir pkg-name)))
(straight--load-package-autoloads pkg-name)))))))))))
;;