diff options
| author | John Wiegley | 2020-06-18 11:04:04 -0700 |
|---|---|---|
| committer | GitHub | 2020-06-18 11:04:04 -0700 |
| commit | 4e72885f852604dc17c5bd543dc6cb88c44cf2f1 (patch) | |
| tree | 8260e86eed475b85670245e83196fb4809dc8966 | |
| parent | 218687d8979b1d6e2d5caee636372725a74ba0d9 (diff) | |
| parent | 203d15e34e99ac6bbe05bd10b2e849bd98d78d31 (diff) | |
| download | emacs-4e72885f852604dc17c5bd543dc6cb88c44cf2f1.tar.gz emacs-4e72885f852604dc17c5bd543dc6cb88c44cf2f1.zip | |
Merge pull request from jjlee/call-hooks-even-if-no-config
GitHub-reference: https://github.com/jwiegley/use-package/issues/840
| -rw-r--r-- | lisp/use-package/use-package-core.el | 2 | ||||
| -rw-r--r-- | test/lisp/use-package/use-package-tests.el | 31 |
2 files changed, 32 insertions, 1 deletions
diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el index 1d637dbf3d0..e81e229a2f0 100644 --- a/lisp/use-package/use-package-core.el +++ b/lisp/use-package/use-package-core.el | |||
| @@ -1468,7 +1468,7 @@ no keyword implies `:all'." | |||
| 1468 | (use-package-concat | 1468 | (use-package-concat |
| 1469 | (when use-package-compute-statistics | 1469 | (when use-package-compute-statistics |
| 1470 | `((use-package-statistics-gather :config ',name nil))) | 1470 | `((use-package-statistics-gather :config ',name nil))) |
| 1471 | (if (or (null arg) (equal arg '(t))) | 1471 | (if (and (or (null arg) (equal arg '(t))) (not use-package-inject-hooks)) |
| 1472 | body | 1472 | body |
| 1473 | (use-package-with-elapsed-timer | 1473 | (use-package-with-elapsed-timer |
| 1474 | (format "Configuring package %s" name-symbol) | 1474 | (format "Configuring package %s" name-symbol) |
diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el index 04a653e30e8..61438185373 100644 --- a/test/lisp/use-package/use-package-tests.el +++ b/test/lisp/use-package/use-package-tests.el | |||
| @@ -1474,6 +1474,37 @@ | |||
| 1474 | (config) | 1474 | (config) |
| 1475 | t)))))) | 1475 | t)))))) |
| 1476 | 1476 | ||
| 1477 | (ert-deftest use-package-test/pre-post-hooks-with-:config () | ||
| 1478 | (let ((use-package-inject-hooks t)) | ||
| 1479 | (match-expansion | ||
| 1480 | (use-package foo :config (config)) | ||
| 1481 | `(progn | ||
| 1482 | (when | ||
| 1483 | (run-hook-with-args-until-failure 'use-package--foo--pre-init-hook) | ||
| 1484 | (run-hooks 'use-package--foo--post-init-hook)) | ||
| 1485 | (require 'foo nil nil) | ||
| 1486 | (when | ||
| 1487 | (run-hook-with-args-until-failure 'use-package--foo--pre-config-hook) | ||
| 1488 | (config) | ||
| 1489 | (run-hooks 'use-package--foo--post-config-hook)) | ||
| 1490 | t)))) | ||
| 1491 | |||
| 1492 | (ert-deftest use-package-test/pre-post-hooks-without-:config () | ||
| 1493 | ;; https://github.com/jwiegley/use-package/issues/785 | ||
| 1494 | (let ((use-package-inject-hooks t)) | ||
| 1495 | (match-expansion | ||
| 1496 | (use-package foo) | ||
| 1497 | `(progn | ||
| 1498 | (when | ||
| 1499 | (run-hook-with-args-until-failure 'use-package--foo--pre-init-hook) | ||
| 1500 | (run-hooks 'use-package--foo--post-init-hook)) | ||
| 1501 | (require 'foo nil nil) | ||
| 1502 | (when | ||
| 1503 | (run-hook-with-args-until-failure 'use-package--foo--pre-config-hook) | ||
| 1504 | t | ||
| 1505 | (run-hooks 'use-package--foo--post-config-hook)) | ||
| 1506 | t)))) | ||
| 1507 | |||
| 1477 | (ert-deftest use-package-test-normalize/:diminish () | 1508 | (ert-deftest use-package-test-normalize/:diminish () |
| 1478 | (should (equal (use-package-normalize-diminish 'foopkg :diminish nil) | 1509 | (should (equal (use-package-normalize-diminish 'foopkg :diminish nil) |
| 1479 | '(foopkg-mode))) | 1510 | '(foopkg-mode))) |