diff options
author | John Wiegley <johnw@gnu.org> | 2024-08-26 11:47:25 -0700 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2024-08-31 13:06:16 +0300 |
commit | 4f521fa14c18f57e5207bffd68e9f79454dccc79 (patch) | |
tree | d91936847dec1a6d05b9397985bdf3d9ca719714 /lisp/use-package | |
parent | bb5576fc9071590143af2106111d95ca2221a20c (diff) | |
download | emacs-4f521fa14c18f57e5207bffd68e9f79454dccc79.tar.gz emacs-4f521fa14c18f57e5207bffd68e9f79454dccc79.tar.bz2 emacs-4f521fa14c18f57e5207bffd68e9f79454dccc79.zip |
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)
Diffstat (limited to 'lisp/use-package')
-rw-r--r-- | lisp/use-package/use-package-core.el | 12 |
1 files changed, 7 insertions, 5 deletions
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)))) |