jwiegley / use-package

A use-package declaration for simplifying your .emacs
https://jwiegley.github.io/use-package
GNU General Public License v3.0
4.42k stars 260 forks source link

Clarify use of :hook with only the name of a hook provided #924

Closed hugonobrega closed 1 year ago

hugonobrega commented 3 years ago

In the readme, one of the examples for adding a hook for loading a package is

(use-package ace-jump-mode
  :hook prog-mode)

As I understand it, this use of :hook with just the name of the hook to add to (well, minus the -hook) will only work under certain conditions, for example when the package name coincides with a function defined by the package (as in the case of ace-jump-mode and its own minor mode). It is that function that is added to the specified hook.

I suggest adding a sentence clarifying this to the readme. Since I don't know the exact set of conditions for this to work, I thought it would be better to create this issue rather than a PR as that would be likely to be incomplete.

skangas commented 1 year ago

I believe this is already documented in the new use-package manual, that will be in the version of use-package distributed with Emacs 29: https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=98e54f597e11fa760553bf7b12d8ebb388b5a488

I'm therefore closing this issue.