Consolidate warnings in use-package-hook!'s docstring
Folks commonly abuse this macro. I'd rather they don't, unless they know exactly what they're doing.
This commit is contained in:
parent
018fc8318d
commit
03f6b3e77c
1 changed files with 9 additions and 4 deletions
|
@ -459,7 +459,8 @@ two extra properties:
|
||||||
(defmacro use-package-hook! (package when &rest body)
|
(defmacro use-package-hook! (package when &rest body)
|
||||||
"Reconfigures a package's `use-package!' block.
|
"Reconfigures a package's `use-package!' block.
|
||||||
|
|
||||||
Only use this macro in a module's init.el file.
|
This macro must be used *before* PACKAGE's `use-package!' block. Often, this
|
||||||
|
means using it from your DOOMDIR/init.el.
|
||||||
|
|
||||||
Under the hood, this uses use-package's `use-package-inject-hooks'.
|
Under the hood, this uses use-package's `use-package-inject-hooks'.
|
||||||
|
|
||||||
|
@ -467,9 +468,13 @@ PACKAGE is a symbol; the package's name.
|
||||||
WHEN should be one of the following:
|
WHEN should be one of the following:
|
||||||
:pre-init :post-init :pre-config :post-config
|
:pre-init :post-init :pre-config :post-config
|
||||||
|
|
||||||
WARNING: If :pre-init or :pre-config hooks return nil, the original
|
WARNINGS:
|
||||||
`use-package!''s :init/:config block (respectively) is overwritten, so remember
|
- The use of this macro is more often than not a code smell. Use it as last
|
||||||
to have them return non-nil (or exploit that to overwrite Doom's config)."
|
resort. There is almost always a better alternative.
|
||||||
|
- If you are using this solely for :post-config, stop! `after!' is much better.
|
||||||
|
- If :pre-init or :pre-config hooks return nil, the original `use-package!''s
|
||||||
|
:init/:config block (respectively) is overwritten, so remember to have them
|
||||||
|
return non-nil (or exploit that to overwrite Doom's config)."
|
||||||
(declare (indent defun))
|
(declare (indent defun))
|
||||||
(unless (memq when '(:pre-init :post-init :pre-config :post-config))
|
(unless (memq when '(:pre-init :post-init :pre-config :post-config))
|
||||||
(error "'%s' isn't a valid hook for use-package-hook!" when))
|
(error "'%s' isn't a valid hook for use-package-hook!" when))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue