mirror of
https://github.com/doomemacs/doomemacs.git
synced 2026-03-07 14:21:47 -08:00
fix(use-package): use-package-ensure-function
Doom is configured to ignore :ensure in `use-package`, unless the user has manually called `(package-initialize)` -- in which case, we assume the user genuinely *wants* to use package.el, or some reason.
This commit is contained in:
parent
7f17dcf09a
commit
eccde78741
1 changed files with 8 additions and 8 deletions
|
|
@ -24,14 +24,14 @@
|
|||
;; packages with package.el, by copying over old `use-package' declarations with
|
||||
;; an :ensure t property. Doom doesn't use package.el, so this will throw an
|
||||
;; error that will confuse beginners, so we disable `:ensure'.
|
||||
(setq use-package-ensure-function
|
||||
(lambda (name &rest _)
|
||||
(message "Ignoring ':ensure t' in '%s' config" name)))
|
||||
;; ...On the other hand, if the user has loaded `package', then we should assume
|
||||
;; they know what they're doing and restore the old behavior:
|
||||
(add-transient-hook! 'package-initialize
|
||||
(when (eq use-package-ensure-function #'ignore)
|
||||
(setq use-package-ensure-function #'use-package-ensure-elpa)))
|
||||
(defun +use-package--ignore-ensure-maybe-fn (name &rest args)
|
||||
;; ...On the other hand, if the user has loaded `package', then we should
|
||||
;; assume they know what they're doing and restore the old behavior:
|
||||
(if (bound-and-true-p package--initialized)
|
||||
(apply #'use-package-ensure-elpa name args)
|
||||
(doom-log "Ignoring ':ensure t' in '%s' config" name)
|
||||
(not (memq name doom-disabled-packages))))
|
||||
(setq use-package-ensure-function #'+use-package--ignore-ensure-maybe-fn)
|
||||
|
||||
(with-eval-after-load 'use-package-core
|
||||
;; `use-package' adds syntax highlighting for the `use-package' macro, but
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue