Install core packages early

This commit is contained in:
Henrik Lissner 2020-05-15 05:32:11 -04:00
parent 87e279ce61
commit 76b133fd98
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 69 additions and 45 deletions

View file

@ -102,13 +102,9 @@ package's name as a symbol, and whose CDR is the plist supplied to its
;;
;;; Bootstrappers
(defun doom-initialize-core-packages (&optional force-p)
"Ensure `straight' is installed and was compiled with this version of Emacs."
(when (or force-p (null (bound-and-true-p straight-recipe-repositories)))
(doom-log "Initializing straight")
(defun doom--ensure-straight ()
(cl-destructuring-bind (&key pin recipe &allow-other-keys)
(let ((doom-packages (doom-package-list nil 'core-only)))
(doom-package-get 'straight))
(doom-package-get 'straight)
(let ((repo-dir (doom-path straight-base-dir "straight/repos/straight.el"))
(repo-url (concat "http" (if gnutls-verify-error "s")
"://github.com/"
@ -146,7 +142,22 @@ package's name as a symbol, and whose CDR is the plist supplied to its
;; Don't install straight for us -- we've already done that -- only set
;; up its recipe repos for us.
(eval-region (search-forward "(require 'straight)")
(point-max)))))))
(point-max))))))
(defun doom-initialize-core-packages (&optional force-p)
"Ensure `straight' is installed and was compiled with this version of Emacs."
(when (or force-p (null (bound-and-true-p straight-recipe-repositories)))
(doom-log "Initializing straight")
(let ((doom-disabled-packages nil)
(doom-packages (doom-package-list nil 'core-only)))
(doom--ensure-straight)
(doom-log "Installing core packages")
(dolist (package doom-packages)
(cl-destructuring-bind (name &key recipe &allow-other-keys)
package
(when recipe
(straight-override-recipe (cons name recipe)))
(straight-use-package name))))))
(defun doom-initialize-packages (&optional force-p)
"Process all packages, essential and otherwise, if they haven't already been.
@ -348,7 +359,11 @@ ones."
for doom--current-module = key
do (doom--read-packages path nil 'noerror)))
(doom--read-packages private-packages all-p 'noerror)))
(reverse doom-packages)))
(cl-remove-if-not
(if core-only-p
(lambda (pkg) (eq (plist-get (cdr pkg) :type) 'core))
#'identity)
(nreverse doom-packages))))
(defun doom-package-pinned-list ()
"Return an alist mapping package names (strings) to pinned commits (strings)."
@ -405,7 +420,7 @@ ones."
;;; Module package macros
(cl-defmacro package!
(name &rest plist &key built-in recipe ignore _pin _disable)
(name &rest plist &key built-in recipe ignore _type _pin _disable)
"Declares a package and how to install it (if applicable).
This macro is declarative and does not load nor install packages. It is used to
@ -416,6 +431,15 @@ Only use this macro in a module's packages.el file.
Accepts the following properties:
:type core|local|built-in|virtual
Specifies what kind of package this is. Can be a symbol or a list thereof.
`core' = this is a protected package and cannot be disabled!
`local' = this package is being modified in-place. This package's repo is
unshallowed and will be skipped when you update packages.
`built-in' = this package is already built-in (otherwise, will be
installed)
`virtual' = this package is not tracked by Doom's package manager. It won't
be installed or uninstalled. Use this to pin 2nd order dependencies.
:recipe RECIPE
Specifies a straight.el recipe to allow you to acquire packages from external
sources. See https://github.com/raxod502/straight.el#the-recipe-format for

View file

@ -7,7 +7,7 @@
;; core-packages.el
(package! straight
;; :type 'core
:type 'core
:recipe `(:host github
:repo "raxod502/straight.el"
:branch ,straight-repository-branch
@ -18,7 +18,7 @@
;; core-modules.el
(package! use-package
;; :type 'core
:type 'core
:pin "c873d5529c9c80cb58222f22873a4f081c307cb2")
;; core-ui.el