If my :config
section is entirely wrapped in with-eval-after-load
, is that equivalent to simply specifying an :after
directive? That is, can I replace this:
(use-package company-tern
:config
(with-eval-after-load 'company
(add-to-list 'company-backends 'company-tern)))
with this
(use-package company-tern
:after company
:config
(add-to-list 'company-backends 'company-tern))
Am I correct in my understanding that if there is other configuration that isn't inside of the with-eval-after-load
then it wouldn't be useful to replace it with an :after
directive since that would defer the loading of the entire package just for the subset of the configuration that depends on the feature?
I should note, in the above situation it seems simple enough to just nest company-tern
's use-package under company
's :config
section, since they're logically related. However, my question is for the more general case where the "dependency" doesn't necessarily have a logical connection, or when there is more than one "dependency."
(add-to-list ...)
line incompany
's:config
. And if you want to defer the loading of the entirecompany-tern
package, you could put(use-package company-tern :config (add-to-list...))
incompany
's:config
.use-package
inside of the:config
. The reason for this doesn't apply to the example I gave, but consider other situations where there is no real logical connection other than using e.g. a function of another package, or when there is more than one such "dependencies," it wouldn't make sense to nest the package under more than one package's:config
section after all.:config
. I'm looking for approaches to situations where there isn't really a logical connection. I will clarify my question for other readers. By the way, if you find and link me those posts I would really appreciate it!