use-package icon indicating copy to clipboard operation
use-package copied to clipboard

Many packages fail to lazy load

Open mcandre opened this issue 4 years ago • 2 comments

Half of the packages in my .emacs file fail to lazy load. For some reason, use-package is trying to load them aggressively early.

https://github.com/mcandre/dotfiles/blob/master/.emacs

I even have to manually (package-install '<package>) to fix them! Instead of use-package installing them.

mcandre avatar Aug 25 '21 19:08 mcandre

You don't mention which packages you think are being loaded too early. You have many forms like this in your init:

(use-package apache-mode)
(use-package clojure-mode)
(use-package coffee-mode)
(use-package cmake-mode)

If you're expecting these to be lazy loaded, you should take a look again at the documentation. Certain keywords imply deferred loading, but not using any (as above) will immediately load the package. use-package is a macro, so you can use macroexpand to see the code it expands to. I suggest doing for any declarations you think aren't being loaded properly.

progfolio avatar Oct 03 '21 19:10 progfolio

Yes, you'll want at minimum (use-package cmake-mode :defer t) for deferred loading.

Be careful, if use-package-always-ensure is false, which is the default, that form will expand to code that does nothing! With use-package-always-ensure true, as you have in your config, that should cause use-package to ensure the package is installed, but it won't load the package.

Try M-x pp-macroexpand-last-sexp when at the end of a use-package form to see what it does.

matta avatar Jan 17 '22 17:01 matta

It seems like this support question was resolved by the above replies, so I'm closing this now.

skangas avatar Nov 13 '22 19:11 skangas