bug#81643: 32.0.50; use-package :hook is not the same as :init add-hook

Björn A. Lindqvist <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
On 8/18/26 22:50, John Wiegley wrote:
 >>>>>> Björn Lindqvist <[email protected]> writes:
 >> I think the problem is with the first two examples in section 4.3.
 >> Specifically:
 >>      :init (add-hook 'c-ts-mode-hook #'my/c-ts-mode-hook)
 >> cannot be simplified to:
 >>      :hook (c-ts-mode . my/c-ts-mode-hook)
 >> It must be:
 >>      :hook ('c-ts-mode . #'my/c-ts-mode-hook)
 >
 > Why is this, exactly? And `('c-ts-mode . #'my/c-ts-mode-hook)' seems very
 > wrong.

No idea. I tried many ways of hooking the symbol and the above was
the only incatation that worked. Whether c-ts-mode or use-package is
at fault I don't know. The problem is so similar so it must be the same 
bug as in Lucas Jimenez' report.

 >> I think the documentation is very confusing. For example:
 >
 >>      (use-package company
 >>      :commands company-mode
 >>      :init
 >>      (add-hook 'prog-mode-hook #'company-mode))
 >
 >> Why is the hook function named company-mode?
 >
 > Because that the name of the function used to turn on company-mode.

How can you know that if you are not familiar with company-mode? Once
you "get" it--that all examples are about turning on input completion
when another mode loads ("setting up autoloads"), it makes
sense. Examples would be clearer if the function was called
#'my-random-hook-fun or something.


-- 
mvh Björn Lindqvist
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.