bug#81643: 32.0.50; use-package :hook is not the same as :init add-hook
John Wiegley <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
>>>>> Eli Zaretskii <[email protected]> writes: > You can also provide a list of hooks. When multiple hooks should be > applied, the following examples are all equivalent: > (use-package company > :hook (prog-mode text-mode)) > (use-package company > :hook ((prog-mode text-mode) . company-mode)) > (use-package company > :hook ((prog-mode . company-mode) > (text-mode . company-mode))) > (use-package company > :commands company-mode > :init > (add-hook 'prog-mode-hook #'company-mode) > (add-hook 'text-mode-hook #'company-mode)) > Are the examples incorrect? These examples are indeed all equivalent, because the `:commands company-mode' declaration in the last use-package block causes the deferred behavior. In the two options reported in the e-mail I responded to, there wasn’t anything added to ensure that both definitions used deferral. -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2