Disable use-package's :ensure t property by default
Many packages recommend setting up their packages with something like: (use-package PACKAGE :ensure t ...) New users will frequently copy these into their config, then experience long startup times or a cryptic error about the package failing to install. This is because `:ensure t`, by default, uses package.el (Emacs' built-in package manager) to check for and install packages, but Doom doesn't use package.el, it uses straight.el. So we disable `:ensure`. On the other hand, if the user has loaded `package` by hand, then we should assume that they know what they're doing, and restore the old behavior.
This commit is contained in:
parent
5e7d684927
commit
24164f4869
1 changed files with 11 additions and 0 deletions
|
@ -254,6 +254,17 @@ This value is cached. If REFRESH-P, then don't use the cached value."
|
|||
;; Macros are already fontified, no need for this
|
||||
(font-lock-remove-keywords 'emacs-lisp-mode use-package-font-lock-keywords)
|
||||
|
||||
;; A common mistake for new users is that they inadvertantly try to install
|
||||
;; their 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.
|
||||
(setq use-package-ensure-function #'ignore)
|
||||
;; ...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)))
|
||||
|
||||
;; We define :minor and :magic-minor from the `auto-minor-mode' package here
|
||||
;; so we don't have to load `auto-minor-mode' so early.
|
||||
(dolist (keyword '(:minor :magic-minor))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue