Fix :hook in 'use-package'
* lisp/use-package/use-package-core.el (use-package-handler/:hook): Support mode variables in :hook declarations. (Bug#72993)
This commit is contained in:
parent
c1cd036d27
commit
e4dc6711b0
1 changed files with 10 additions and 7 deletions
|
@ -1376,13 +1376,16 @@ enable gathering statistics."
|
||||||
(when fun
|
(when fun
|
||||||
(mapcar
|
(mapcar
|
||||||
#'(lambda (sym)
|
#'(lambda (sym)
|
||||||
(if (boundp sym)
|
(let ((symname (symbol-name sym)))
|
||||||
`(add-hook (quote ,sym) (function ,fun))
|
(if (and (boundp sym)
|
||||||
`(add-hook
|
;; Mode variables are usually bound, but
|
||||||
(quote ,(intern
|
;; their hooks are named FOO-mode-hook.
|
||||||
(concat (symbol-name sym)
|
(not (string-suffix-p "-mode" symname)))
|
||||||
use-package-hook-name-suffix)))
|
`(add-hook (quote ,sym) (function ,fun))
|
||||||
(function ,fun))))
|
`(add-hook
|
||||||
|
(quote ,(intern
|
||||||
|
(concat symname 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))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue