package!: accept 'prefer in :built-in property

This tells Doom's package manager to prefer the built-in package, if it
is present, rather than installing the new version from elpa.
This commit is contained in:
Henrik Lissner 2019-07-05 20:03:37 +02:00
parent eb42f95777
commit 1f644d07e0
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -178,7 +178,8 @@ Accepts the following properties:
:freeze FORM
Do not update this package if FORM is non-nil.
:built-in BOOL
Same as :ignore if the package is a built-in Emacs package.
Same as :ignore if the package is a built-in Emacs package. If set to
'prefer, will use built-in package if it is present.
Returns t if package is successfully registered, and nil if it was disabled
elsewhere."
@ -203,6 +204,8 @@ elsewhere."
plist (plist-put plist :modules module-list))))
(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-site-load-path)))
(setq plist (plist-put plist :ignore built-in)))
(while plist
(unless (null (cadr plist))