use-package
use-package copied to clipboard
hook: Add check for -mode suffix automatically
Hello, the code
(use-package org-bullets
:ensure t
:hook (org-mode . org-bullets-mode))
works just fine. However, I expected
(use-package org-bullets
:ensure t
:hook org-mode)
fails with
(org-bullets org-ref-org-menu #[0 "ÀÁÂÃÄ$" [add-hook change-major-mode-hook org-show-block-all append local] 5] #[0 "ÀÁÂÃÄ$" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes org-bullets-mode visual-line-mode)
So it seems, that use-package expects the activation function to be called exactly like the mode and does not try to append -mode
to it.
Wouldn't it be wise to try for org-bullets-mode
in this case?
Or am I mistaken on that?
I came here to say the same thing. The majority of modes don’t include the word “mode” in package name.
I came across the general.el
package which provides the :ghook
keyword. It is smart enough to infer the -mode
for the function name but can’t infer the -hook
for the hook name. Go figure 😕
I came across the general.el package which provides the :ghook keyword. It is smart enough to infer the -mode for the function name but can’t infer the -hook for the hook name. Go figure confused
It was an intentional design decision. If someone really wants it, I can make the shorthand opt-in.