use-package
use-package copied to clipboard
:hook does not defer if on expansion it contains a lambda?
The following use-package
declaration does not get deferred as I would expect using the :hook
keyword but perhaps this is a misunderstanding on my part.
(use-package yaml-mode
:ensure t
:hook (yaml-mode . (lambda () (run-hooks 'prog-mode-hook))))
If instead I explicitly include the :defer
keyword as follows it does get deferred as desired.
(use-package yaml-mode
:ensure t
:hook (yaml-mode . (lambda () (run-hooks 'prog-mode-hook)))
:defer t)
In the first case I believe it does not get deferred because of the use of the lambda. The use-package-deferring-keywords
docstring states "... :hook
... only imply deferred loading if they reference actual function symbols that can be autoloaded from the module." Is that the case here? Thanks for your time.
same issue here.
I can reproduce this on the latest version of use-package. It seems like a bug to me.