2

How can I defer loading a package when it is installed using package.el with use-package? Basically, I want the package I use to only be activated using use-package instead of package-initialize so that this snippet would produce an error:

(use-package company
  :init
  (global-company-mode)
  (message "Company mode enabled globally"))

(and changing :init to :config would work as expected)

2

I have found the answer here: Using package.el to install and update but use-package for loading and configuring

Basically, you can use package.el to manage packages and call (package-initialize t) to setup load paths but not activate them.

1

while I don't know the specific answer to your question, use_package supports :defer n which will defer loading the package containing :defer for n seconds.

there is also :disabled which may be of help to you.

As a complete example, the use-package author John Wiegley uses this snippet for which-key:

(use-package which-key
  :disabled t
  :load-path "site-lisp/which-key"
  :diminish which-key-mode
  :commands which-key-mode
  :defer 10
  :config
  (which-key-mode 1))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.