[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: use-package :after ??
From: |
Eli Zaretskii |
Subject: |
Re: use-package :after ?? |
Date: |
Thu, 18 May 2023 13:36:20 +0300 |
> From: David Masterson <dsmasterson@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Wed, 17 May 2023 13:30:24 -0700
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > No, :after says that a will be loaded immediately after b, and _only_
> > if b is loaded. If b is never loaded, neither will a.
>
> So, you're saying, if (via :bind) I call a-mode before a and b have been
> loaded (but their autoloads are setup), b will not be loaded and,
> therefore, neither will a (because of :after) causing the call to a-mode
> via the :bind to fail?
No, I'm saying that :bind will cause Emacs to attempt loading a if you
invoke the command to which the key was bound by :bind. But if a
cannot be loaded before b, then when Emacs attempts to auto-load a, it
will likely signal an error because b was not loaded yet. Or maybe a
will load successfully, but doing so will not produce the effect the
user wanted, because b is not loaded.
> :bind is one of the triggers to autoload the
> package (a in this case), so this would be unexpected.
Which part is unexpected?
> In your mind, what is the use-case for :after?
Like I said before: :after is just a short for eval-after-load. So
any use case where a package has another package as its prerequisite
can use :after. But that doesn't mean you can now forget about
loading those prerequisites.
> If there is a
> requirement that a must have b, you would expect a to require b
> internally (no need for after).
Not necessarily. a might need b because the user wants to use them in
combination. Or a might change its behavior if b is loaded (testing
that via featurep), for example. Or for some other reason.
use-package doesn't expect a to require b. If a requires b, then
perhaps you don't need to mention the :after dependency between them
at all.
> Am I missing something?!?
You are over-thinking use-package. It is nothing more than an easy
way of define conditions for loading packages and their autoloads.
> I wish I could put all of this discussion in a set of test cases to
> run through Emacs. Would ERT be the tool for that (never used it)?
If you want to run tests, ERT is the framework for doing that, yes.
- Re: use-package :after ??, (continued)
- Message not available
- Re: use-package :after ??, David Masterson, 2023/05/15
- Re: use-package :after ??, Eli Zaretskii, 2023/05/15
- Re: use-package :after ??, David Masterson, 2023/05/15
- Re: use-package :after ??, Eli Zaretskii, 2023/05/16
- Re: use-package :after ??, David Masterson, 2023/05/16
- Re: use-package :after ??, David Masterson, 2023/05/16
- Re: use-package :after ??, Eli Zaretskii, 2023/05/17
- Re: use-package :after ??, David Masterson, 2023/05/17
- Re: use-package :after ??,
Eli Zaretskii <=
- Re: use-package :after ??, Lynn Winebarger, 2023/05/18
- Re: use-package :after ??, David Masterson, 2023/05/18
- Re: use-package :after ??, David Masterson, 2023/05/18
- Re: use-package :after ??, Eli Zaretskii, 2023/05/11
- Re: use-package :after ??, David Masterson, 2023/05/11
- Re: use-package :after ??, Eli Zaretskii, 2023/05/12
- Re: use-package :after ??, David Masterson, 2023/05/12
- Re: use-package :after ??, Emanuel Berg, 2023/05/13