Closed memeplex closed 2 years ago
With the example that is in the documentation:
(use-package projectile
:bind-keymap
("C-c p" . projectile-command-map))
about which it's stated:
This is handled behind the scenes by generating custom code that loads the package containing the keymap, and then re-executes your keypress after the first load, to reinterpret that keypress as a prefix key.
The stub is indeed there:
C-c p runs the command (lambda nil (interactive)
(use-package-autoload-keymap 'projectile-command-map 'projectile nil))
(found in global-map), which is an interactive Lisp function.
But as I said, M-x projectile
show a number of matches (78) even before calling the stub by pressing C-c p
.
Ok, I think I now understand what happens. There is this projectile-autoloads.el
file which is obviously providing the stubs. So if my understanding is correct, autoloads are always done, what is deferred is the require
of the file. I'm closing this because I'm 99% sure this is like I've said, but if the author were so kind as to provide some explanation regarding the phases of the loading process, I'd be very grateful.
Also, what's the point of the stubs that use-package itself generates when a package already provides its autoloads? Wouldn't it be two levels of indirection to achieve the same? Are most packages poorly behaved in this regard?
Sorry if this is a misunderstanding on my part but I've read the README and the use-package docstring and I can't figure out why the following is happening.
In my early-init.el I have:
In my init.el I have the standard straight bootstrap plus:
Then, take for example:
AFAICU this form should defer loading of projectile because of the keymap binding.
But immediately after initialization a lot of
M-x projectile-
functions are available. Interestingly enough,*Messages*
doesn't show the loading message for projectile. But still the functions are there ready to be called (andautoloadp
returnsnil
on them).If I comment out the
use-package
form, no projectile functions are available instead.