Refactor doom-initialize-packages & package API

- Packages are initialized once, when package.el is first loaded, and
  must be updated manually via doom/reload-packages.
- Package->module association is now stored in the package's PLIST under
  :modules. This is an internal property and cannot be explicitly set
  through `package!'
- Add doom-package-list function
- Rename doom-get-packages to doom-find-packages
- Updated doom-find-packages' docstring
- Added the :core filter to doom-find-packages
- Simplified doom-initialize-packages
- doom/reload calls doom/reload-packages if necessary.
- Fix redundant properties in doom-packages
- Remove tracking of after!, def-package! and def-package-hook! blocks.
  Replaced with doom-package-list being able to see all packages, even
  in disabled modules.
- Add :built-in property to package! for dummy packages. This is
  important so that doom/describe-package can see built-in packages.
This commit is contained in:
Henrik Lissner 2019-03-06 00:26:33 -05:00
parent 8bfa5a30fd
commit a443d9ab07
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
8 changed files with 207 additions and 182 deletions

View file

@ -188,15 +188,6 @@ non-nil, return paths of possible modules, activated or otherwise."
collect (plist-get plist :path)))
(list doom-private-dir)))
(defun doom-module-register-config (package file &optional append)
"TODO"
(let ((files (get package 'doom-files)))
(unless (member file files)
(if append
(setq files (append files (list file)))
(push file files))
(put package 'doom-files files))))
(defun doom-modules (&optional refresh-p)
"Minimally initialize `doom-modules' (a hash table) and return it."
(or (unless refresh-p doom-modules)
@ -372,9 +363,7 @@ package is disabled."
;; package errors, so we preform this check at compile time:
(and (bound-and-true-p byte-compile-current-file)
(not (locate-library (symbol-name name)))))
`(progn
(doom-module-register-config ',name ,(FILE!) t)
(use-package ,name ,@plist))))
`(use-package ,name ,@plist)))
(defmacro def-package-hook! (package when &rest body)
"Reconfigures a package's `def-package!' block.
@ -396,7 +385,6 @@ to have them return non-nil (or exploit that to overwrite Doom's config)."
(error "'%s' isn't a valid hook for def-package-hook!" when))
`(progn
(setq use-package-inject-hooks t)
(doom-module-register-config ',package ,(FILE!))
(add-hook!
',(intern (format "use-package--%s--%s-hook"
package