Fix handling of hook variables in 'use-package'

* lisp/use-package/use-package-core.el
(use-package-handler/:hook): Append "-hook" to the symbol's name
only if the named hook variable has no 'symbol-value'.
(Bug#72818)
This commit is contained in:
John Wiegley 2024-08-26 11:47:25 -07:00 committed by Eli Zaretskii
parent bb5576fc90
commit 4f521fa14c

View file

@ -1376,11 +1376,13 @@ enable gathering statistics."
(when fun
(mapcar
#'(lambda (sym)
`(add-hook
(quote ,(intern
(concat (symbol-name sym)
use-package-hook-name-suffix)))
(function ,fun)))
(if (boundp sym)
`(add-hook (quote ,sym) (function ,fun))
`(add-hook
(quote ,(intern
(concat (symbol-name sym)
use-package-hook-name-suffix)))
(function ,fun))))
(use-package-hook-handler-normalize-mode-symbols syms)))))
(use-package-normalize-commands args))))