mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-08 13:19:36 +00:00
Merge pull request from jjlee/call-hooks-even-if-no-config
GitHub-reference: https://github.com/jwiegley/use-package/issues/840
This commit is contained in:
commit
4e72885f85
2 changed files with 32 additions and 1 deletions
|
@ -1468,7 +1468,7 @@ no keyword implies `:all'."
|
|||
(use-package-concat
|
||||
(when use-package-compute-statistics
|
||||
`((use-package-statistics-gather :config ',name nil)))
|
||||
(if (or (null arg) (equal arg '(t)))
|
||||
(if (and (or (null arg) (equal arg '(t))) (not use-package-inject-hooks))
|
||||
body
|
||||
(use-package-with-elapsed-timer
|
||||
(format "Configuring package %s" name-symbol)
|
||||
|
|
|
@ -1474,6 +1474,37 @@
|
|||
(config)
|
||||
t))))))
|
||||
|
||||
(ert-deftest use-package-test/pre-post-hooks-with-:config ()
|
||||
(let ((use-package-inject-hooks t))
|
||||
(match-expansion
|
||||
(use-package foo :config (config))
|
||||
`(progn
|
||||
(when
|
||||
(run-hook-with-args-until-failure 'use-package--foo--pre-init-hook)
|
||||
(run-hooks 'use-package--foo--post-init-hook))
|
||||
(require 'foo nil nil)
|
||||
(when
|
||||
(run-hook-with-args-until-failure 'use-package--foo--pre-config-hook)
|
||||
(config)
|
||||
(run-hooks 'use-package--foo--post-config-hook))
|
||||
t))))
|
||||
|
||||
(ert-deftest use-package-test/pre-post-hooks-without-:config ()
|
||||
;; https://github.com/jwiegley/use-package/issues/785
|
||||
(let ((use-package-inject-hooks t))
|
||||
(match-expansion
|
||||
(use-package foo)
|
||||
`(progn
|
||||
(when
|
||||
(run-hook-with-args-until-failure 'use-package--foo--pre-init-hook)
|
||||
(run-hooks 'use-package--foo--post-init-hook))
|
||||
(require 'foo nil nil)
|
||||
(when
|
||||
(run-hook-with-args-until-failure 'use-package--foo--pre-config-hook)
|
||||
t
|
||||
(run-hooks 'use-package--foo--post-config-hook))
|
||||
t))))
|
||||
|
||||
(ert-deftest use-package-test-normalize/:diminish ()
|
||||
(should (equal (use-package-normalize-diminish 'foopkg :diminish nil)
|
||||
'(foopkg-mode)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue