Evaluate package! properties & error on :fetcher
- No longer translates :fetcher to :host. Update your package! declaration people! - Now evaluates the values for properties (except for :recipe IF it is a list whose CAR passes keywordp -- for backwards compatibility). - Throws error if an invalid property is used for a package!'s :recipe
This commit is contained in:
parent
ffb4aa91da
commit
3195b84fd2
2 changed files with 21 additions and 25 deletions
|
@ -81,7 +81,7 @@
|
|||
|
||||
Excludes packages that have a non-nil :built-in property."
|
||||
(when-let (plist (doom-package-get package))
|
||||
(not (plist-get plist :ignore) t)))
|
||||
(not (plist-get plist :ignore))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom-package-private-p (package)
|
||||
|
|
|
@ -254,7 +254,7 @@ necessary package metadata is initialized and available for them."
|
|||
;;; Module package macros
|
||||
|
||||
(cl-defmacro package!
|
||||
(name &rest plist &key built-in _recipe disable ignore _freeze)
|
||||
(name &rest plist &key built-in recipe ignore _disable _freeze)
|
||||
"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
|
||||
|
@ -282,6 +282,12 @@ Accepts the following properties:
|
|||
Returns t if package is successfully registered, and nil if it was disabled
|
||||
elsewhere."
|
||||
(declare (indent defun))
|
||||
(when (and recipe (keywordp (car-safe recipe)))
|
||||
(plist-put! plist :recipe `(quote ,recipe)))
|
||||
(when built-in
|
||||
(when (and (not ignore) (eq built-in 'prefer))
|
||||
(setq built-in `(locate-library ,(symbol-name name) nil doom--initial-load-path)))
|
||||
(plist-put! plist :ignore built-in))
|
||||
`(let* ((name ',name)
|
||||
(plist (cdr (assq name doom-packages))))
|
||||
(let ((module-list (plist-get plist :modules))
|
||||
|
@ -292,33 +298,23 @@ elsewhere."
|
|||
(list module)
|
||||
nil))))
|
||||
|
||||
;; Handle :built-in
|
||||
(let ((built-in ,built-in))
|
||||
(unless ,ignore
|
||||
(when built-in
|
||||
(doom-log "Ignoring built-in package %S" name)
|
||||
(when (eq built-in 'prefer)
|
||||
(setq built-in (locate-library (symbol-name name) nil doom--initial-load-path))))
|
||||
(plist-put! plist :ignore built-in)))
|
||||
|
||||
;; DEPRECATED Translate :fetcher to :host
|
||||
(with-plist! plist (recipe)
|
||||
(with-plist! recipe (fetcher)
|
||||
(when fetcher
|
||||
(message "%s\n%s"
|
||||
(format "WARNING: The :fetcher property was used for the %S package."
|
||||
name)
|
||||
"This property is deprecated. Replace it with :host.")
|
||||
(plist-put! recipe :host fetcher)
|
||||
(plist-delete! recipe :fetcher))
|
||||
(plist-put! plist :recipe recipe)))
|
||||
|
||||
(doplist! ((prop val) ',plist plist)
|
||||
(doplist! ((prop val) (list ,@plist) plist)
|
||||
(unless (null val)
|
||||
(plist-put! plist prop val)))
|
||||
|
||||
;; Some basic key validation; error if you're not using a valid key
|
||||
(condition-case e
|
||||
(cl-destructuring-bind
|
||||
(&key _local-repo _files _flavor _no-build
|
||||
_type _repo _host _branch _remote _nonrecursive _fork _depth)
|
||||
(plist-get plist :recipe))
|
||||
(error
|
||||
(signal 'doom-package-error
|
||||
(cons ,(symbol-name name)
|
||||
(error-message-string e)))))
|
||||
|
||||
(setf (alist-get name doom-packages) plist)
|
||||
(if (not ,disable) t
|
||||
(if (not (plist-get plist :disable)) t
|
||||
(doom-log "Disabling package %S" name)
|
||||
(cl-pushnew name doom-disabled-packages)
|
||||
nil)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue