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 (when fun
(mapcar (mapcar
#'(lambda (sym) #'(lambda (sym)
`(add-hook (if (boundp sym)
(quote ,(intern `(add-hook (quote ,sym) (function ,fun))
(concat (symbol-name sym) `(add-hook
use-package-hook-name-suffix))) (quote ,(intern
(function ,fun))) (concat (symbol-name sym)
use-package-hook-name-suffix)))
(function ,fun))))
(use-package-hook-handler-normalize-mode-symbols syms))))) (use-package-hook-handler-normalize-mode-symbols syms)))))
(use-package-normalize-commands args)))) (use-package-normalize-commands args))))