emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-30 4f521fa14c1: Fix handling of hook variables in 'use-package'


From: Eli Zaretskii
Subject: emacs-30 4f521fa14c1: Fix handling of hook variables in 'use-package'
Date: Sat, 31 Aug 2024 06:07:46 -0400 (EDT)

branch: emacs-30
commit 4f521fa14c18f57e5207bffd68e9f79454dccc79
Author: John Wiegley <johnw@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    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(-)

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))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]