summaryrefslogtreecommitdiff
path: root/lisp/use-package/use-package-core.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/use-package/use-package-core.el')
-rw-r--r--lisp/use-package/use-package-core.el12
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))))