From 4f521fa14c18f57e5207bffd68e9f79454dccc79 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 26 Aug 2024 11:47:25 -0700 Subject: 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) --- lisp/use-package/use-package-core.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lisp/use-package/use-package-core.el') diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el index 7148c334126..2c5fc560749 100644 --- a/lisp/use-package/use-package-core.el +++ b/lisp/use-package/use-package-core.el @@ -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)))) -- cgit v1.2.3