Open sellout opened 1 month ago
Sorry, one more specific question …
(require 'foo)
(use-package 'bar
:after foo
:custom (bar-var foo-var)) ; default is nil
(use-package foo
:custom (foo-var t)) ; default is nil
Will bar-var
be t
or nil
at the end of this? I’m pretty sure it’ll be nil
, because :after
only observes whether a package is loaded, not whether its use-package
form has been evaluated, right? So :after
isn’t necessarily that good at enforcing order-independence. In practice this often comes up because some other non-deferred package contained a (require 'foo)
.
So, I think the documentation of :after
needs to be clarified a bit around that.
I feel like I’m being really critical here, so I just want to say that I understand that is is complicated, and use-package is a fantastic project.
Use-Package has been incorporated into Emacs proper so this repository is mostly dead. You should try asking your questions on the Emacs mailing list.
I think this is a documentation issue, because I can’t seem to figure out what I can expect from certain keywords.
tl;dr: I think a flow chart of some sort would really help me understand which keywords fire when.
For example,
The docs say “Use the
:init
keyword to execute code before a package is loaded”, but what does “before a package is loaded” mean? Will:init
fire linearly when theuse-package
is encountered, or will it wait until something else forces the loading of this package?What I expect this form to do is execute the
:init
immediately, which will then cause the package to be loaded (withoutuse-package
handling the loading). The actual situation I have is that I haveuse-package-always-defer t
, and I’m wondering if I can expect packages to be loaded because of the autoloads on their init form.Or should I be doing something else re: loading packages? The examples in the README show a lot of examples like
but that seems backward to me. It should be the package-defined autoload that causes a call to
(foo-global-mode)
to load the package (but I get that there’s not a lot of difference without:defer
).Similarly, how does
:after
interact with:init
? This somewhat depends on the answer to the previous question, but assuming:init
normally fires immediately, does:after
defer it until after its dependencies are loaded, or will it still fire immediately?Does
bar-global-mode
get run before or afterfoo-var
is set? And, if it‘s after, I assume that that’s no longer true if there’s a(require 'foo)
above(use-package bar …
, right?Sorry for this rambling description. I just come up with these questions time and time again when I’m working on my config, and sometimes bother to trace through the code to see what’s happening and sometimes don’t, but it seems like it should be more obvious. I have more questions like this, but I’m hoping it’s possible to include a somewhat comprehensive description of all of these things without enumerating more of the specific confusions I’ve had.