* use-package :after ??
@ 2023-05-08 0:05 David Masterson
2023-05-08 2:44 ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-05-08 12:19 ` Eli Zaretskii
0 siblings, 2 replies; 37+ messages in thread
From: David Masterson @ 2023-05-08 0:05 UTC (permalink / raw)
To: help-gnu-emacs
Didn't see this post, so ...
This might be a documentation problem...
I'm not sure I understand ":after" (and a few other related things) in
use-package. The info docs talk about it ensuring that the current
package is loaded after the other listed packages, but it's not quite
explicit (to me) about what that means. I interpret it in two possible
ways:
1. If any of the listed packages are not loaded currently, then the
current package will not be loaded. Period.
2. #1 + "magic" will be done to ensure that, once the listed packages
are loaded, the current package will be (auto?) loaded.
If #1 is correct, I do not know how the current package will ever be
loaded if ":after" fails. If #2 is correct, I do not know what the
"magic" could be to safely do this.
My goal is to organwize my .emacs loading of 25+ packages to only load if
needed. That means (almost) all packages are deferred at startup and
will load itself and subpackages (minor modes, etc.) when I try to call
the package. This is what I hoped :after was for.
Can someone advise on the proper use of ":after" and how to get
appropriate subpackages to also load when the main package is loaded.
For instance:
(use-package org-ac :after org)
(use-package org)
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-08 0:05 use-package :after ?? David Masterson
@ 2023-05-08 2:44 ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-05-08 4:05 ` David Masterson
2023-05-08 12:19 ` Eli Zaretskii
1 sibling, 1 reply; 37+ messages in thread
From: Ruijie Yu via Users list for the GNU Emacs text editor @ 2023-05-08 2:44 UTC (permalink / raw)
To: David Masterson; +Cc: help-gnu-emacs
David Masterson <dsmasterson@gmail.com> writes:
> 1. If any of the listed packages are not loaded currently, then the
> current package will not be loaded. Period.
> 2. #1 + "magic" will be done to ensure that, once the listed packages
> are loaded, the current package will be (auto?) loaded.
>
> If #1 is correct, I do not know how the current package will ever be
> loaded if ":after" fails. If #2 is correct, I do not know what the
> "magic" could be to safely do this.
TL;DR: #2, see below.
> For instance:
>
> (use-package org-ac :after org)
> (use-package org)
This is what I get when I `macroexpand' the first `use-package' call
with `use-package-always-defer' set to nil.
[ If `u-p-a-defer' is set to t when I `macroexpand', the
`eval-after-load' call reduces to nil on expand-time because this
package is not installed, nor does `package.el' know how to install it
because I only have gnu and nongnu elpa configured. ]
--8<---------------cut here---------------start------------->8---
(progn
(defvar use-package--warning3
#'(lambda
(keyword err)
(let
((msg
(format "%s/%s: %s" 'org-ac keyword
(error-message-string err))))
(display-warning 'use-package msg :error))))
(condition-case-unless-debug err
(eval-after-load 'org
'(if
(not
(require 'org-ac nil t))
(display-warning 'use-package
(format "Cannot load %s" 'org-ac)
:error)))
(error
(funcall use-package--warning3 :catch err))))
--8<---------------cut here---------------end--------------->8---
So, this might help you understand what is happening under the hood.
Essentially, it will try to load org-ac, only after *all packages*
listed in the :after section, showing a warning if loading org-ac fails.
Keep in mind, according to the macroexpand result, that this also means
that if you load the subpackage `org-ac' manually (via a hook, autoload,
etc), it is not going to try to load `org' at all. I feel that this is
kind of strange, but maybe it has its reasons.
> My goal is to organwize my .emacs loading of 25+ packages to only load if
> needed. That means (almost) all packages are deferred at startup and
> will load itself and subpackages (minor modes, etc.) when I try to call
> the package. This is what I hoped :after was for.
>
> Can someone advise on the proper use of ":after" and how to get
> appropriate subpackages to also load when the main package is loaded.
It seems that you opted to go with setting `u-p-a-defer' to t. And
since you didn't mention :ensure at all, I assume you set `u-p-a-ensure'
to t as well.
In this case, order doesn't _really_ matter, you just need to
`(use-package sub-pkg :after main-pkg :config your-other-configs)' on
all your subpackages.
Note, since you use `org' as an example, that you should probably
`(use-package org)' first thing in your init.el, because otherwise
something else is probably going to load builtin `org', and the Elpa
`org' will complain afterwards about mismatched versions.
--
Best,
RY
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-08 2:44 ` Ruijie Yu via Users list for the GNU Emacs text editor
@ 2023-05-08 4:05 ` David Masterson
2023-05-08 4:25 ` Ruijie Yu via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 37+ messages in thread
From: David Masterson @ 2023-05-08 4:05 UTC (permalink / raw)
To: Ruijie Yu via Users list for the GNU Emacs text editor; +Cc: Ruijie Yu
Thanks for the followup.
Ruijie Yu via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> David Masterson <dsmasterson@gmail.com> writes:
>
>> 1. If any of the listed packages are not loaded currently, then the
>> current package will not be loaded. Period.
>> 2. #1 + "magic" will be done to ensure that, once the listed packages
>> are loaded, the current package will be (auto?) loaded.
>>
>> If #1 is correct, I do not know how the current package will ever be
>> loaded if ":after" fails. If #2 is correct, I do not know what the
>> "magic" could be to safely do this.
>
> TL;DR: #2, see below.
I tried to write it to be skimmable. ;)
>> For instance:
>>
>> (use-package org-ac :after org)
>> (use-package org)
>
> This is what I get when I `macroexpand' the first `use-package' call
> with `use-package-always-defer' set to nil.
Which I assumed is the default and goal (defer all packages until you
need them).
> [ If `u-p-a-defer' is set to t when I `macroexpand', the
> `eval-after-load' call reduces to nil on expand-time because this
> package is not installed, nor does `package.el' know how to install it
> because I only have gnu and nongnu elpa configured. ]
Understood
> (progn
> (defvar use-package--warning3
> #'(lambda
> (keyword err)
> (let
> ((msg
> (format "%s/%s: %s" 'org-ac keyword
> (error-message-string err))))
> (display-warning 'use-package msg :error))))
> (condition-case-unless-debug err
> (eval-after-load 'org
> '(if
> (not
> (require 'org-ac nil t))
> (display-warning 'use-package
> (format "Cannot load %s" 'org-ac)
> :error)))
> (error
> (funcall use-package--warning3 :catch err))))
Hmm.
> So, this might help you understand what is happening under the hood.
> Essentially, it will try to load org-ac, only after *all packages*
> listed in the :after section, showing a warning if loading org-ac fails.
I presume the 'if' gets more complicated and more 'eval-after-load'
calls are done if :after lists more than one item, correct?
> Keep in mind, according to the macroexpand result, that this also means
> that if you load the subpackage `org-ac' manually (via a hook, autoload,
> etc), it is not going to try to load `org' at all. I feel that this is
> kind of strange, but maybe it has its reasons.
Hmm.
> It seems that you opted to go with setting `u-p-a-defer' to t. And
> since you didn't mention :ensure at all, I assume you set `u-p-a-ensure'
> to t as well.
I'm looking at 'ensure'. I currently use 'auto-update' package.
> In this case, order doesn't _really_ matter, you just need to
> `(use-package sub-pkg :after main-pkg :config your-other-configs)' on
> all your subpackages.
I thought I had. I even had 'org' before 'org-ac' (but after
'auto-complete') in .emacs, but things weren't working right until I
hand loaded 'org-ac'. I'll have to test this some more.
How did you do the macroexpand to debug this? I haven't seen that
technique. Looks interesting.
> Note, since you use `org' as an example, that you should probably
> `(use-package org)' first thing in your init.el, because otherwise
> something else is probably going to load builtin `org', and the Elpa
> `org' will complain afterwards about mismatched versions.
Yes, I ran into that. I wound up removing the builtin manually. I
believe org has been trying to fix this.
Thanks
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-08 4:05 ` David Masterson
@ 2023-05-08 4:25 ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-05-08 5:20 ` David Masterson
0 siblings, 1 reply; 37+ messages in thread
From: Ruijie Yu via Users list for the GNU Emacs text editor @ 2023-05-08 4:25 UTC (permalink / raw)
To: David Masterson; +Cc: Ruijie Yu via Users list for the GNU Emacs text editor
David Masterson <dsmasterson@gmail.com> writes:
> Thanks for the followup.
>
> Ruijie Yu via Users list for the GNU Emacs text editor
> <help-gnu-emacs@gnu.org> writes:
>
>> David Masterson <dsmasterson@gmail.com> writes:
>>
>>> 1. If any of the listed packages are not loaded currently, then the
>>> current package will not be loaded. Period.
>>> 2. #1 + "magic" will be done to ensure that, once the listed packages
>>> are loaded, the current package will be (auto?) loaded.
>>>
>>> If #1 is correct, I do not know how the current package will ever be
>>> loaded if ":after" fails. If #2 is correct, I do not know what the
>>> "magic" could be to safely do this.
>>
>> TL;DR: #2, see below.
>
> I tried to write it to be skimmable. ;)
>
>>> For instance:
>>>
>>> (use-package org-ac :after org)
>>> (use-package org)
>>
>> This is what I get when I `macroexpand' the first `use-package' call
>> with `use-package-always-defer' set to nil.
>
> Which I assumed is the default and goal (defer all packages until you
> need them).
>
>> [ If `u-p-a-defer' is set to t when I `macroexpand', the
>> `eval-after-load' call reduces to nil on expand-time because this
>> package is not installed, nor does `package.el' know how to install it
>> because I only have gnu and nongnu elpa configured. ]
>
> Understood
>
>> (progn
>> (defvar use-package--warning3
>> #'(lambda
>> (keyword err)
>> (let
>> ((msg
>> (format "%s/%s: %s" 'org-ac keyword
>> (error-message-string err))))
>> (display-warning 'use-package msg :error))))
>> (condition-case-unless-debug err
>> (eval-after-load 'org
>> '(if
>> (not
>> (require 'org-ac nil t))
>> (display-warning 'use-package
>> (format "Cannot load %s" 'org-ac)
>> :error)))
>> (error
>> (funcall use-package--warning3 :catch err))))
>
> Hmm.
>
>> So, this might help you understand what is happening under the hood.
>> Essentially, it will try to load org-ac, only after *all packages*
>> listed in the :after section, showing a warning if loading org-ac fails.
>
> I presume the 'if' gets more complicated and more 'eval-after-load'
> calls are done if :after lists more than one item, correct?
Yes, see this snippet:
What I ran:
--8<---------------cut here---------------start------------->8---
(let ((use-package-always-defer nil) (use-package-always-ensure nil))
(macroexpand-1 '(use-package foo :after (bar baz))))
--8<---------------cut here---------------end--------------->8---
What I got:
--8<---------------cut here---------------start------------->8---
(progn
(defvar use-package--warning9
#'(lambda
(keyword err)
(let
((msg
(format "%s/%s: %s" 'foo keyword
(error-message-string err))))
(display-warning 'use-package msg :error))))
(condition-case-unless-debug err
(eval-after-load 'baz
'(eval-after-load 'bar
'(if
(not
(require 'foo nil t))
(display-warning 'use-package
(format "Cannot load %s" 'foo)
:error))))
(error
(funcall use-package--warning9 :catch err))))
--8<---------------cut here---------------end--------------->8---
This also answers your question of "how to macroexpand". There are also
the two functions
`macroexpand' and `macroexpand-all' which you can try to use as well.
>> Keep in mind, according to the macroexpand result, that this also means
>> that if you load the subpackage `org-ac' manually (via a hook, autoload,
>> etc), it is not going to try to load `org' at all. I feel that this is
>> kind of strange, but maybe it has its reasons.
>
> Hmm.
>
>> It seems that you opted to go with setting `u-p-a-defer' to t. And
>> since you didn't mention :ensure at all, I assume you set `u-p-a-ensure'
>> to t as well.
>
> I'm looking at 'ensure'. I currently use 'auto-update' package.
>
>> In this case, order doesn't _really_ matter, you just need to
>> `(use-package sub-pkg :after main-pkg :config your-other-configs)' on
>> all your subpackages.
>
> I thought I had. I even had 'org' before 'org-ac' (but after
> 'auto-complete') in .emacs, but things weren't working right until I
> hand loaded 'org-ac'. I'll have to test this some more.
>
> How did you do the macroexpand to debug this? I haven't seen that
> technique. Looks interesting.
>
>> Note, since you use `org' as an example, that you should probably
>> `(use-package org)' first thing in your init.el, because otherwise
>> something else is probably going to load builtin `org', and the Elpa
>> `org' will complain afterwards about mismatched versions.
>
> Yes, I ran into that. I wound up removing the builtin manually. I
> believe org has been trying to fix this.
>
> Thanks
--
Best,
RY
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-08 4:25 ` Ruijie Yu via Users list for the GNU Emacs text editor
@ 2023-05-08 5:20 ` David Masterson
0 siblings, 0 replies; 37+ messages in thread
From: David Masterson @ 2023-05-08 5:20 UTC (permalink / raw)
To: Ruijie Yu via Users list for the GNU Emacs text editor; +Cc: Ruijie Yu
Ruijie Yu via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> Yes, see this snippet:
>
> What I ran:
>
> (let ((use-package-always-defer nil) (use-package-always-ensure nil))
> (macroexpand-1 '(use-package foo :after (bar baz))))
>
>
> What I got:
>
> (progn
> (defvar use-package--warning9
> #'(lambda
> (keyword err)
> (let
> ((msg
> (format "%s/%s: %s" 'foo keyword
> (error-message-string err))))
> (display-warning 'use-package msg :error))))
> (condition-case-unless-debug err
> (eval-after-load 'baz
> '(eval-after-load 'bar
> '(if
> (not
> (require 'foo nil t))
> (display-warning 'use-package
> (format "Cannot load %s" 'foo)
> :error))))
> (error
> (funcall use-package--warning9 :catch err))))
>
> This also answers your question of "how to macroexpand". There are
> also the two functions `macroexpand' and `macroexpand-all' which you
> can try to use as well.
Thanks again
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-08 0:05 use-package :after ?? David Masterson
2023-05-08 2:44 ` Ruijie Yu via Users list for the GNU Emacs text editor
@ 2023-05-08 12:19 ` Eli Zaretskii
2023-05-10 23:56 ` David Masterson
1 sibling, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-08 12:19 UTC (permalink / raw)
To: help-gnu-emacs
> From: David Masterson <dsmasterson@gmail.com>
> Date: Sun, 07 May 2023 17:05:57 -0700
>
> This might be a documentation problem...
>
> I'm not sure I understand ":after" (and a few other related things) in
> use-package. The info docs talk about it ensuring that the current
> package is loaded after the other listed packages, but it's not quite
> explicit (to me) about what that means. I interpret it in two possible
> ways:
>
> 1. If any of the listed packages are not loaded currently, then the
> current package will not be loaded. Period.
> 2. #1 + "magic" will be done to ensure that, once the listed packages
> are loaded, the current package will be (auto?) loaded.
Which parts of the documentation make the answer to this question less
than obvious? There should be no need to expand the use-package
macros to understand what it is doing; just reading the documentation
should be enough (and it is for me, FWIW).
> My goal is to organwize my .emacs loading of 25+ packages to only load if
> needed. That means (almost) all packages are deferred at startup and
> will load itself and subpackages (minor modes, etc.) when I try to call
> the package. This is what I hoped :after was for.
AFAIU, :after is not about deferral, it's about the conditions to
load. use-package has other features for deferral, like :defer and
use-package-always-defer.
And for loading when needed you have autoloads, of course.
> Can someone advise on the proper use of ":after" and how to get
> appropriate subpackages to also load when the main package is loaded.
> For instance:
>
> (use-package org-ac :after org)
> (use-package org)
What is unclear or not self-evident about the above?
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-08 12:19 ` Eli Zaretskii
@ 2023-05-10 23:56 ` David Masterson
2023-05-11 3:24 ` David Masterson
2023-05-11 5:54 ` Eli Zaretskii
0 siblings, 2 replies; 37+ messages in thread
From: David Masterson @ 2023-05-10 23:56 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Hi Eli,
I'm still confused about where the problem is, but I'll try to explain.
Eli Zaretskii <eliz@gnu.org> writes:
>> From: David Masterson <dsmasterson@gmail.com>
>> Date: Sun, 07 May 2023 17:05:57 -0700
>>
>> This might be a documentation problem...
I have a fairly lengthy .emacs (probably nowhere near as complex as
yours) that I've setup use-package to speed up starting Emacs. I've
(mostly) alphabetized my packages and use-package them in sequence.
I've set to deferred loading and I'm using :after to get subpackages to
load when the main package loads (ie: org-ac <- org).
My current problem is that org-ac is not loading after first using org
even though I've the :after flag on org-ac. If I hand load og-ac,
everthing is fine.
>> I'm not sure I understand ":after" (and a few other related things) in
>> use-package. The info docs talk about it ensuring that the current
>> package is loaded after the other listed packages, but it's not quite
>> explicit (to me) about what that means. I interpret it in two possible
>> ways:
The key section is 3.5 in use-package infodoc.
>> 1. If any of the listed packages are not loaded currently, then the
>> current package will not be loaded. Period.
>> 2. #1 + "magic" will be done to ensure that, once the listed packages
>> are loaded, the current package will be (auto?) loaded.
>
> Which parts of the documentation make the answer to this question less
> than obvious? There should be no need to expand the use-package
> macros to understand what it is doing; just reading the documentation
> should be enough (and it is for me, FWIW).
Section 3.1 talks about load and autoload, but could be extended to talk
about how use-package uses autoload to make things happen -- at least by
mentioning what use-package things (like :con fig) will happen at
autoload versus when the use-package is called.
In section 3.5, the first sentence talks about "configure", but
shouldn't it really be "load and configure"? Also, the example is not
really good because it says that "‘:after’ is not strictly necessary" in
this case. Better to reverse it and say what will happen in both the
demand and defered cases (I don't use it, but I guess this should also
be done in 3.4 and 3.6).
>> My goal is to organize my .emacs loading of 25+ packages to only load if
>> needed. That means (almost) all packages are deferred at startup and
>> will load itself and subpackages (minor modes, etc.) when I try to call
>> the package. This is what I hoped :after was for.
>
> AFAIU, :after is not about deferral, it's about the conditions to
> load. use-package has other features for deferral, like :defer and
> use-package-always-defer.
>
> And for loading when needed you have autoloads, of course.
Yes, :after is about when to load. I'm looking to figure out why org-ac
didn't load when I needed for org. I need more time to play with it.
>> Can someone advise on the proper use of ":after" and how to get
>> appropriate subpackages to also load when the main package is loaded.
>> For instance:
>>
>> (use-package org-ac :after org)
>> (use-package org)
>
> What is unclear or not self-evident about the above?
From the macroexpand, I now understand some of the "magic" of autoload.
I'm still missing how the :config (etc.) happens after the autoload to
ensure that the package is configured. That's important in helping me
look for side-effects in the :config that didn't work with autoload
(ie. I need :demand somewhere).
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-10 23:56 ` David Masterson
@ 2023-05-11 3:24 ` David Masterson
2023-05-11 6:14 ` Eli Zaretskii
2023-05-11 5:54 ` Eli Zaretskii
1 sibling, 1 reply; 37+ messages in thread
From: David Masterson @ 2023-05-11 3:24 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Wow, i need to proofread more...
David Masterson <dsmasterson@gmail.com> writes:
> Hi Eli,
>
> I'm still confused about where the problem is, but I'll try to explain.
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: David Masterson <dsmasterson@gmail.com>
>>> Date: Sun, 07 May 2023 17:05:57 -0700
>>>
>>> This might be a documentation problem...
>
> I have a fairly lengthy .emacs (probably nowhere near as complex as
> yours) that I've setup use-package to speed up starting Emacs. I've
> (mostly) alphabetized my packages and use-package them in sequence.
> I've set to deferred loading and I'm using :after to get subpackages to
> load when the main package loads (ie: org-ac <- org).
>
> My current problem is that org-ac is not loading after first using org
> even though I've added the :after flag on org-ac. If I hand load og-ac,
> everthing is fine.
>
>>> I'm not sure I understand ":after" (and a few other related things) in
>>> use-package. The info docs talk about it ensuring that the current
>>> package is loaded after the other listed packages, but it's not quite
>>> explicit (to me) about what that means. I interpret it in two possible
>>> ways:
>
> The key section is 3.5 in use-package infodoc.
>
>>> 1. If any of the listed packages are not loaded currently, then the
>>> current package will not be loaded. Period.
>>> 2. #1 + "magic" will be done to ensure that, once the listed packages
>>> are loaded, the current package will be (auto?) loaded.
>>
>> Which parts of the documentation make the answer to this question less
>> than obvious? There should be no need to expand the use-package
>> macros to understand what it is doing; just reading the documentation
>> should be enough (and it is for me, FWIW).
>
> Section 3.1 talks about load and autoload, but could be extended to talk
> about how use-package uses autoload to make things happen -- at least by
> mentioning what use-package things (like :con fig) will happen at
> autoload versus when the use-package is called.
>
> In section 3.5, the first sentence talks about "configure", but
> shouldn't it really be "load and configure"? Also, the example is not
> really good because it says that "':after' is not strictly necessary"
> in this case. Better to reverse it (put ivy-avy first) and say what
> will happen in both the demand and deferred cases (I don't use it, but
> I guess this should also be done in 3.4 and 3.6).
>
>>> My goal is to organize my .emacs loading of 25+ packages to only load if
>>> needed. That means (almost) all packages are deferred at startup and
>>> will load itself and subpackages (minor modes, etc.) when I try to call
>>> the package. This is what I hoped :after was for.
>>
>> AFAIU, :after is not about deferral, it's about the conditions to
>> load. use-package has other features for deferral, like :defer and
>> use-package-always-defer.
>>
>> And for loading when needed you have autoloads, of course.
>
> Yes, :after is about when to load. I'm looking to figure out why org-ac
> didn't load when I needed it for org. I need more time to play with it.
>
>>> Can someone advise on the proper use of ":after" and how to get
>>> appropriate subpackages to also load when the main package is loaded.
>>> For instance:
>>>
>>> (use-package org-ac :after org)
>>> (use-package org)
>>
>> What is unclear or not self-evident about the above?
>
> From the macroexpand, I now understand some of the "magic" of autoload.
> I'm still missing how the :config (etc.) happens after the autoload to
> ensure that the package is configured. That's important in helping me
> look for side-effects in the :config that didn't work with autoload
> (ie. maybe I need :demand somewhere).
One thing I left out was that org-ac also depends on auto-complete-pcmp
making the :after more complicated -- namely does order make a
difference in how things should be loaded?
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-10 23:56 ` David Masterson
2023-05-11 3:24 ` David Masterson
@ 2023-05-11 5:54 ` Eli Zaretskii
2023-05-11 22:04 ` David Masterson
1 sibling, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-11 5:54 UTC (permalink / raw)
To: help-gnu-emacs
> From: David Masterson <dsmasterson@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Wed, 10 May 2023 16:56:35 -0700
>
> >> For instance:
> >>
> >> (use-package org-ac :after org)
> >> (use-package org)
> >
> > What is unclear or not self-evident about the above?
>
> >From the macroexpand, I now understand some of the "magic" of autoload.
> I'm still missing how the :config (etc.) happens after the autoload to
> ensure that the package is configured. That's important in helping me
> look for side-effects in the :config that didn't work with autoload
> (ie. I need :demand somewhere).
Would it help to say in the manual that :after's effect is the same or
similar to with-eval-after-load?
In general, when I'm told that :after causes the package FOO to be
loaded after another package, my interpretation is that at the end of
loading that other package Emacs will load package FOO. If that is
not what you understand, could you take another look at the
description of :after in the use-package manual and tell what is
missing there to convey this meaning?
Or are you saying that my interpretation is inaccurate or incorrect?
Thanks.
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-11 3:24 ` David Masterson
@ 2023-05-11 6:14 ` Eli Zaretskii
2023-05-11 21:24 ` David Masterson
0 siblings, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-11 6:14 UTC (permalink / raw)
To: help-gnu-emacs
> From: David Masterson <dsmasterson@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Wed, 10 May 2023 20:24:18 -0700
>
> One thing I left out was that org-ac also depends on auto-complete-pcmp
> making the :after more complicated -- namely does order make a
> difference in how things should be loaded?
Depends how? via autoloads or via :after?
And why does it make thing more complicated? If package FOO should be
loaded after BAR, and BAR should be loaded after BAZ, then the order
I'd expect should be: BAZ, then BAR, then FOO. Right?
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-11 6:14 ` Eli Zaretskii
@ 2023-05-11 21:24 ` David Masterson
2023-05-12 1:18 ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-05-12 5:59 ` Eli Zaretskii
0 siblings, 2 replies; 37+ messages in thread
From: David Masterson @ 2023-05-11 21:24 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: David Masterson <dsmasterson@gmail.com>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Wed, 10 May 2023 20:24:18 -0700
>>
>> One thing I left out was that org-ac also depends on auto-complete-pcmp
>> making the :after more complicated -- namely does order make a
>> difference in how things should be loaded?
>
> Depends how? via autoloads or via :after?
>
> And why does it make thing more complicated? If package FOO should be
> loaded after BAR, and BAR should be loaded after BAZ, then the order
> I'd expect should be: BAZ, then BAR, then FOO. Right?
Yes. Will that be handled properly by the following (with global
deferred loading)?
(use-package foo :after bar
:config (foo-setup)
)
(use-package bar :after baz
# :demand t
)
(use-package baz)
In particular, use-package will ensure foo-setup is called after foo is
loaded, right? If I uncommented the :demand, should/would that make a
difference?
I may be overthinking this because of my org-ac issue and this looked
like an obvious debugging approach.
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-11 5:54 ` Eli Zaretskii
@ 2023-05-11 22:04 ` David Masterson
2023-05-12 6:14 ` Eli Zaretskii
0 siblings, 1 reply; 37+ messages in thread
From: David Masterson @ 2023-05-11 22:04 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: David Masterson <dsmasterson@gmail.com>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Wed, 10 May 2023 16:56:35 -0700
>>
>> >> For instance:
>> >>
>> >> (use-package org-ac :after org)
>> >> (use-package org)
>> >
>> > What is unclear or not self-evident about the above?
>>
>> >From the macroexpand, I now understand some of the "magic" of autoload.
>> I'm still missing how the :config (etc.) happens after the autoload to
>> ensure that the package is configured. That's important in helping me
>> look for side-effects in the :config that didn't work with autoload
>> (ie. I need :demand somewhere).
>
> Would it help to say in the manual that :after's effect is the same or
> similar to with-eval-after-load?
I don't think so. In 40 years of playing with Emacs, I don't think I've
ever used with-eval-after-load (copied w/o understanding maybe) -- I'm
an old hacker, not an elisp programmer. Better to talk about the
semantics that :after implements with respect to other things
use-package does that might be affected (defer vs demand, init/config,
...).
> In general, when I'm told that :after causes the package FOO to be
> loaded after another package, my interpretation is that at the end of
> loading that other package Emacs will load package FOO. If that is
> not what you understand, could you take another look at the
> description of :after in the use-package manual and tell what is
> missing there to convey this meaning?
Basically, I think the sections on :if, :after, and :requires should
make clear what will (should?) happen if package loading is deferred
(individually or globally). Do these happen when use-package is called
or when autoload occurs? Demand loading should mean they're immediately
evaluated. Deferred and mixed is more complicated.
For instance, what happens if A should be after B, but you never define
B with use-package? Or B is demand loaded later?
Or make the rule explicit in infodoc that :after does what it does
regardless of demand/defer.
> Or are you saying that my interpretation is inaccurate or incorrect?
I'm thinking I might be over thinking this because nothing else obvious
popped up in my issue with org-ac. I'll keep looking, though.
Thanks for letting me bend your ear.
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-11 21:24 ` David Masterson
@ 2023-05-12 1:18 ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-05-12 6:33 ` Eli Zaretskii
2023-05-12 5:59 ` Eli Zaretskii
1 sibling, 1 reply; 37+ messages in thread
From: Ruijie Yu via Users list for the GNU Emacs text editor @ 2023-05-12 1:18 UTC (permalink / raw)
To: David Masterson; +Cc: Eli Zaretskii, help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]
David Masterson <dsmasterson@gmail.com> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: David Masterson <dsmasterson@gmail.com>
>>> Cc: help-gnu-emacs@gnu.org
>>> Date: Wed, 10 May 2023 20:24:18 -0700
>>>
>>> One thing I left out was that org-ac also depends on auto-complete-pcmp
>>> making the :after more complicated -- namely does order make a
>>> difference in how things should be loaded?
>>
>> Depends how? via autoloads or via :after?
>>
>> And why does it make thing more complicated? If package FOO should be
>> loaded after BAR, and BAR should be loaded after BAZ, then the order
>> I'd expect should be: BAZ, then BAR, then FOO. Right?
>
> Yes. Will that be handled properly by the following (with global
> deferred loading)?
>
> (use-package foo :after bar
> :config (foo-setup)
> )
> (use-package bar :after baz
> # :demand t
> )
> (use-package baz)
>
> In particular, use-package will ensure foo-setup is called after foo is
> loaded, right? If I uncommented the :demand, should/would that make a
> difference?
>
> I may be overthinking this because of my org-ac issue and this looked
> like an obvious debugging approach.
I attach my scratch session after macroexpanding with the :demand t
(after a pretty-print because I don't think having everything on one
line helps much). You should be able to figure out the answer to your
question by looking at the generated form and playing around with the
macroexpand form.
[-- Attachment #2: macroexpand-result-scratch.eld --]
[-- Type: text/plain, Size: 3341 bytes --]
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.
(setq-local eval-expression-print-level nil)
(macroexpand-all
'(progn
(use-package foo :after bar :config (foo-setup))
(use-package bar :after baz :demand t)
(use-package baz)))
(progn
(progn
(defvar use-package--warning3 #'(lambda (keyword err)
(let ((msg (format
"%s/%s: %s"
'foo
keyword
(error-message-string err))))
(display-warning
'use-package
msg
:error))))
(condition-case err
(eval-after-load
'bar
#'(lambda nil
(if (not (require 'foo nil t))
(display-warning
'use-package
(format "Cannot load %s" 'foo)
:error)
(condition-case err
(progn (foo-setup) t)
((debug error)
(funcall
use-package--warning3
:config err))))))
((debug error)
(funcall
use-package--warning3
:catch err))))
(progn
(defvar use-package--warning4 #'(lambda (keyword err)
(let ((msg (format
"%s/%s: %s"
'bar
keyword
(error-message-string err))))
(display-warning
'use-package
msg
:error))))
(condition-case err
(eval-after-load
'baz
#'(lambda nil
(if (not (require 'bar nil t))
(display-warning
'use-package
(format "Cannot load %s" 'bar)
:error))))
((debug error)
(funcall
use-package--warning4
:catch err))))
(progn
(defvar use-package--warning5 #'(lambda (keyword err)
(let ((msg (format
"%s/%s: %s"
'baz
keyword
(error-message-string err))))
(display-warning
'use-package
msg
:error))))
(condition-case err
(if (not (require 'baz nil t))
(display-warning
'use-package
(format "Cannot load %s" 'baz)
:error))
((debug error)
(funcall
use-package--warning5
:catch err)))))
[-- Attachment #3: Type: text/plain, Size: 16 bytes --]
--
Best,
RY
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-11 21:24 ` David Masterson
2023-05-12 1:18 ` Ruijie Yu via Users list for the GNU Emacs text editor
@ 2023-05-12 5:59 ` Eli Zaretskii
2023-05-12 6:54 ` David Masterson
1 sibling, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-12 5:59 UTC (permalink / raw)
To: help-gnu-emacs
> From: David Masterson <dsmasterson@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Thu, 11 May 2023 14:24:08 -0700
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > And why does it make thing more complicated? If package FOO should be
> > loaded after BAR, and BAR should be loaded after BAZ, then the order
> > I'd expect should be: BAZ, then BAR, then FOO. Right?
>
> Yes. Will that be handled properly by the following (with global
> deferred loading)?
>
> (use-package foo :after bar
> :config (foo-setup)
> )
> (use-package bar :after baz
> # :demand t
> )
> (use-package baz)
>
> In particular, use-package will ensure foo-setup is called after foo is
> loaded, right? If I uncommented the :demand, should/would that make a
> difference?
I don't think it would make a difference, but why on earth are you
using :demand there? It makes no sense to me.
In any case, if there's something unclear here, the problem might be
with the description of :demand, not with :after -- the node "Forcing
loading" says :demand is overridden by :defer, but says nothing about
:after.
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-11 22:04 ` David Masterson
@ 2023-05-12 6:14 ` Eli Zaretskii
2023-05-12 6:31 ` Emanuel Berg
2023-05-12 6:56 ` David Masterson
0 siblings, 2 replies; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-12 6:14 UTC (permalink / raw)
To: help-gnu-emacs
> From: David Masterson <dsmasterson@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Thu, 11 May 2023 15:04:50 -0700
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > In general, when I'm told that :after causes the package FOO to be
> > loaded after another package, my interpretation is that at the end of
> > loading that other package Emacs will load package FOO. If that is
> > not what you understand, could you take another look at the
> > description of :after in the use-package manual and tell what is
> > missing there to convey this meaning?
>
> Basically, I think the sections on :if, :after, and :requires should
> make clear what will (should?) happen if package loading is deferred
> (individually or globally). Do these happen when use-package is called
> or when autoload occurs? Demand loading should mean they're immediately
> evaluated. Deferred and mixed is more complicated.
Sorry, I still don't see the difficulty. The manual says that using
:after causes one package to be loaded immediately after the other
one--how is this unclear? Please bear with me, because I really don't
understand what bothers you. It is crystal clear to me. So there's
some misunderstanding here.
> For instance, what happens if A should be after B, but you never define
> B with use-package?
Isn't it clear? If B is never loaded, A will _never_ be loaded in
that case. It doesn't matter whether B is loaded via use-package or
by some other means. How is this NOT clear from the description?
> Or B is demand loaded later?
Later than what? A will _always_ be loaded as the last step in
loading B, whenever the latter happens.
> Or make the rule explicit in infodoc that :after does what it does
> regardless of demand/defer.
So is the difficulty because of :defer and/or :demand? If so, please
ask questions that involve those. Because so far you were asking
about :after alone, and there I see nothing unclear.
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-12 6:14 ` Eli Zaretskii
@ 2023-05-12 6:31 ` Emanuel Berg
2023-05-12 6:56 ` David Masterson
1 sibling, 0 replies; 37+ messages in thread
From: Emanuel Berg @ 2023-05-12 6:31 UTC (permalink / raw)
To: help-gnu-emacs
Eli Zaretskii wrote:
>> For instance, what happens if A should be after B, but you
>> never define B with use-package?
>
> Isn't it clear? If B is never loaded, A will _never_ be
> loaded in that case. It doesn't matter whether B is loaded
> via use-package or by some other means. How is this NOT
> clear from the description?
>
>> Or B is demand loaded later?
>
> Later than what? A will _always_ be loaded as the last step
> in loading B, whenever the latter happens.
>
>> Or make the rule explicit in infodoc that :after does what
>> it does regardless of demand/defer.
>
> So is the difficulty because of :defer and/or :demand?
> If so, please ask questions that involve those. Because so
> far you were asking about :after alone, and there I see
> nothing unclear.
Why should this be done manually at all?
For example, a source file should just say, I need X, Y and
Z since I use stuff from those.
What order they are loaded shouldn't matter since they are
all needed. Also, whatever stuff they themselves need is up to
them to solve - with the same simple method, preferably.
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-12 1:18 ` Ruijie Yu via Users list for the GNU Emacs text editor
@ 2023-05-12 6:33 ` Eli Zaretskii
2023-05-12 6:38 ` Emanuel Berg
0 siblings, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-12 6:33 UTC (permalink / raw)
To: help-gnu-emacs
> From: Ruijie Yu <ruijie@netyu.xyz>
> Cc: Eli Zaretskii <eliz@gnu.org>, help-gnu-emacs@gnu.org
> Date: Fri, 12 May 2023 09:18:14 +0800
>
> David Masterson <dsmasterson@gmail.com> writes:
>
> > Eli Zaretskii <eliz@gnu.org> writes:
> >
> >> Depends how? via autoloads or via :after?
> >>
> >> And why does it make thing more complicated? If package FOO should be
> >> loaded after BAR, and BAR should be loaded after BAZ, then the order
> >> I'd expect should be: BAZ, then BAR, then FOO. Right?
> >
> > Yes. Will that be handled properly by the following (with global
> > deferred loading)?
> >
> > (use-package foo :after bar
> > :config (foo-setup)
> > )
> > (use-package bar :after baz
> > # :demand t
> > )
> > (use-package baz)
> >
> > In particular, use-package will ensure foo-setup is called after foo is
> > loaded, right? If I uncommented the :demand, should/would that make a
> > difference?
> >
> > I may be overthinking this because of my org-ac issue and this looked
> > like an obvious debugging approach.
>
> I attach my scratch session after macroexpanding with the :demand t
> (after a pretty-print because I don't think having everything on one
> line helps much). You should be able to figure out the answer to your
> question by looking at the generated form and playing around with the
> macroexpand form.
Thanks, but the discussion here is centered on the documentation of
use-package and whether it needs some improvements and clarifications.
There should be no need to examine the macro-expansion of
use-package's macros to reason about the documentation clarity.
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-12 6:33 ` Eli Zaretskii
@ 2023-05-12 6:38 ` Emanuel Berg
0 siblings, 0 replies; 37+ messages in thread
From: Emanuel Berg @ 2023-05-12 6:38 UTC (permalink / raw)
To: help-gnu-emacs
Eli Zaretskii wrote:
> Thanks, but the discussion here is centered on the
> documentation of use-package and whether it needs some
> improvements and clarifications. There should be no need to
> examine the macro-expansion of use-package's macros to
> reason about the documentation clarity.
It should be automated based on the packages own properties,
with no extra source needed, then the documentation will be
even more clear - and it will work much better, as well.
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-12 5:59 ` Eli Zaretskii
@ 2023-05-12 6:54 ` David Masterson
2023-05-12 7:22 ` Eli Zaretskii
0 siblings, 1 reply; 37+ messages in thread
From: David Masterson @ 2023-05-12 6:54 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: David Masterson <dsmasterson@gmail.com>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Thu, 11 May 2023 14:24:08 -0700
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> > And why does it make thing more complicated? If package FOO should be
>> > loaded after BAR, and BAR should be loaded after BAZ, then the order
>> > I'd expect should be: BAZ, then BAR, then FOO. Right?
>>
>> Yes. Will that be handled properly by the following (with global
>> deferred loading)?
>>
>> (use-package foo :after bar
>> :config (foo-setup)
>> )
>> (use-package bar :after baz
>> # :demand t
>> )
>> (use-package baz)
>>
>> In particular, use-package will ensure foo-setup is called after foo is
>> loaded, right? If I uncommented the :demand, should/would that make a
>> difference?
>
> I don't think it would make a difference, but why on earth are you
> using :demand there? It makes no sense to me.
It's a made up example to ask what would happen if one (or more) of the
interdependent packages is demand loaded while the others are deferred.
Via the :after, does the demand load of bar force baz and foo to load?
If not, is that a problem?
> In any case, if there's something unclear here, the problem might be
> with the description of :demand, not with :after -- the node "Forcing
> loading" says :demand is overridden by :defer, but says nothing about
> :after.
Possibly, but the above (made up) example was an attempt to determine if
:after might effect when the loads occur due to a side effect. Perhaps
this side effect might be important in certain cases.
Oh, that Info node says :demand is overridden by :defer, but docstring
for use-package-always-defer says assume :defer unless :demand is used.
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-12 6:14 ` Eli Zaretskii
2023-05-12 6:31 ` Emanuel Berg
@ 2023-05-12 6:56 ` David Masterson
1 sibling, 0 replies; 37+ messages in thread
From: David Masterson @ 2023-05-12 6:56 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: David Masterson <dsmasterson@gmail.com>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Thu, 11 May 2023 15:04:50 -0700
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> > In general, when I'm told that :after causes the package FOO to be
>> > loaded after another package, my interpretation is that at the end of
>> > loading that other package Emacs will load package FOO. If that is
>> > not what you understand, could you take another look at the
>> > description of :after in the use-package manual and tell what is
>> > missing there to convey this meaning?
>>
>> Basically, I think the sections on :if, :after, and :requires should
>> make clear what will (should?) happen if package loading is deferred
>> (individually or globally). Do these happen when use-package is called
>> or when autoload occurs? Demand loading should mean they're immediately
>> evaluated. Deferred and mixed is more complicated.
>
> Sorry, I still don't see the difficulty. The manual says that using
> :after causes one package to be loaded immediately after the other
> one--how is this unclear? Please bear with me, because I really don't
> understand what bothers you. It is crystal clear to me. So there's
> some misunderstanding here.
>
>> For instance, what happens if A should be after B, but you never define
>> B with use-package?
>
> Isn't it clear? If B is never loaded, A will _never_ be loaded in
> that case. It doesn't matter whether B is loaded via use-package or
> by some other means. How is this NOT clear from the description?
>
>> Or B is demand loaded later?
>
> Later than what? A will _always_ be loaded as the last step in
> loading B, whenever the latter happens.
>
>> Or make the rule explicit in infodoc that :after does what it does
>> regardless of demand/defer.
>
> So is the difficulty because of :defer and/or :demand? If so, please
> ask questions that involve those. Because so far you were asking
> about :after alone, and there I see nothing unclear.
See the other message.
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-12 6:54 ` David Masterson
@ 2023-05-12 7:22 ` Eli Zaretskii
2023-05-15 6:03 ` David Masterson
[not found] ` <87pm72m8rc.fsf@penguin>
0 siblings, 2 replies; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-12 7:22 UTC (permalink / raw)
To: help-gnu-emacs
> From: David Masterson <dsmasterson@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Thu, 11 May 2023 23:54:06 -0700
>
> > In any case, if there's something unclear here, the problem might be
> > with the description of :demand, not with :after -- the node "Forcing
> > loading" says :demand is overridden by :defer, but says nothing about
> > :after.
>
> Possibly, but the above (made up) example was an attempt to determine if
> :after might effect when the loads occur due to a side effect. Perhaps
> this side effect might be important in certain cases.
>
> Oh, that Info node says :demand is overridden by :defer, but docstring
> for use-package-always-defer says assume :defer unless :demand is used.
Are we still talking about :after? My questions were meant to figure
out whether :after's documentation needs some improvements.
If everything is clear with :after, and we are talking about :demand
and :defer, let's talk about those two. The text you quote is about
use-package-always-defer, not about :defer, so how is that a
contradiction to whether :defer overrides :demand?
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-12 7:22 ` Eli Zaretskii
@ 2023-05-15 6:03 ` David Masterson
2023-05-15 11:36 ` Eli Zaretskii
[not found] ` <87pm72m8rc.fsf@penguin>
1 sibling, 1 reply; 37+ messages in thread
From: David Masterson @ 2023-05-15 6:03 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: David Masterson <dsmasterson@gmail.com>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Thu, 11 May 2023 23:54:06 -0700
>>
>> > In any case, if there's something unclear here, the problem might be
>> > with the description of :demand, not with :after -- the node "Forcing
>> > loading" says :demand is overridden by :defer, but says nothing about
>> > :after.
>>
>> Possibly, but the above (made up) example was an attempt to determine if
>> :after might effect when the loads occur due to a side effect. Perhaps
>> this side effect might be important in certain cases.
>>
>> Oh, that Info node says :demand is overridden by :defer, but docstring
>> for use-package-always-defer says assume :defer unless :demand is used.
>
> Are we still talking about :after? My questions were meant to figure
> out whether :after's documentation needs some improvements.
>
> If everything is clear with :after, and we are talking about :demand
> and :defer, let's talk about those two. The text you quote is about
> use-package-always-defer, not about :defer, so how is that a
> contradiction to whether :defer overrides :demand?
Question: why would anyone include both :defer and :demand in one
use-package? Syntactically, it's appropriate to answer the question of
which takes precedence. Semantically, though, most users wouldn't do
that.
My question goes to the effect of :after in connecting a tree of
packages that may have been setup with some :demand and some :defer.
This can occur by direct usage of :demand and :defer *or* by setting
use-package-always-defer and overriding it with :demand in some
packages. Example:
(use-package a :defer t :after b)
(use-package b :demand t :after c)
(use-package c :defer t)
Does b force the loading of a and/or c because of :after and the mixed
:demand/:defer? Or is b forced to defer?
The potential (lack of?) side-effects here should be mentioned as it
might effect on :config for a, b, or c.
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
[not found] ` <87pm72m8rc.fsf@penguin>
@ 2023-05-15 6:16 ` David Masterson
2023-05-15 11:42 ` Eli Zaretskii
0 siblings, 1 reply; 37+ messages in thread
From: David Masterson @ 2023-05-15 6:16 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
David Masterson <dsmasterson@gmail.com> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: David Masterson <dsmasterson@gmail.com>
>>> Cc: help-gnu-emacs@gnu.org
>>> Date: Thu, 11 May 2023 23:54:06 -0700
>>>
>>> > In any case, if there's something unclear here, the problem might be
>>> > with the description of :demand, not with :after -- the node "Forcing
>>> > loading" says :demand is overridden by :defer, but says nothing about
>>> > :after.
>>>
>>> Possibly, but the above (made up) example was an attempt to determine if
>>> :after might effect when the loads occur due to a side effect. Perhaps
>>> this side effect might be important in certain cases.
>>>
>>> Oh, that Info node says :demand is overridden by :defer, but docstring
>>> for use-package-always-defer says assume :defer unless :demand is used.
>>
>> Are we still talking about :after? My questions were meant to figure
>> out whether :after's documentation needs some improvements.
>>
>> If everything is clear with :after, and we are talking about :demand
>> and :defer, let's talk about those two. The text you quote is about
>> use-package-always-defer, not about :defer, so how is that a
>> contradiction to whether :defer overrides :demand?
>
> Question: why would anyone include both :defer and :demand in one
> use-package? Syntactically, it's appropriate to answer the question of
> which takes precedence. Semantically, though, most users wouldn't do
> that.
>
> My question goes to the effect of :after in connecting a tree of
> packages that may have been setup with some :demand and some :defer.
> This can occur by direct usage of :demand and :defer *or* by setting
> use-package-always-defer and overriding it with :demand in some
> packages. Example:
>
> (use-package a :defer t :after b)
> (use-package b :demand t :after c)
> (use-package c :defer t)
>
> Does b force the loading of a and/or c because of :after and the mixed
> :demand/:defer? Or is b forced to defer?
>
> The potential (lack of?) side-effects here should be mentioned as it
> might effect on :config for a, b, or c.
Minor addition:
If a, b, and c were all ':defer t' and a had ':bind ("C-." . b-mode)'
and I later hit that key, that would load c, then b, then a -- right?
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-15 6:03 ` David Masterson
@ 2023-05-15 11:36 ` Eli Zaretskii
2023-05-15 22:19 ` David Masterson
0 siblings, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-15 11:36 UTC (permalink / raw)
To: help-gnu-emacs
> From: David Masterson <dsmasterson@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Sun, 14 May 2023 23:03:19 -0700
>
> My question goes to the effect of :after in connecting a tree of
> packages that may have been setup with some :demand and some :defer.
> This can occur by direct usage of :demand and :defer *or* by setting
> use-package-always-defer and overriding it with :demand in some
> packages. Example:
>
> (use-package a :defer t :after b)
> (use-package b :demand t :after c)
> (use-package c :defer t)
>
> Does b force the loading of a and/or c because of :after and the mixed
> :demand/:defer? Or is b forced to defer?
a will be loaded immediately after b is loaded.
b will be loaded immediately after c is loaded.
> The potential (lack of?) side-effects here should be mentioned as it
> might effect on :config for a, b, or c.
Sorry, I don't understand this.
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-15 6:16 ` David Masterson
@ 2023-05-15 11:42 ` Eli Zaretskii
2023-05-15 22:27 ` David Masterson
0 siblings, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-15 11:42 UTC (permalink / raw)
To: help-gnu-emacs
> From: David Masterson <dsmasterson@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Sun, 14 May 2023 23:16:52 -0700
>
> If a, b, and c were all ':defer t' and a had ':bind ("C-." . b-mode)'
> and I later hit that key, that would load c, then b, then a -- right?
No, based on my reading of the docs I think it will cause an error
(because b cannot be loaded without c being loaded).
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-15 11:36 ` Eli Zaretskii
@ 2023-05-15 22:19 ` David Masterson
2023-05-16 16:16 ` Eli Zaretskii
0 siblings, 1 reply; 37+ messages in thread
From: David Masterson @ 2023-05-15 22:19 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: David Masterson <dsmasterson@gmail.com>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Sun, 14 May 2023 23:03:19 -0700
>>
>> My question goes to the effect of :after in connecting a tree of
>> packages that may have been setup with some :demand and some :defer.
>> This can occur by direct usage of :demand and :defer *or* by setting
>> use-package-always-defer and overriding it with :demand in some
>> packages. Example:
>>
>> (use-package a :defer t :after b)
>> (use-package b :demand t :after c)
>> (use-package c :defer t)
>>
>> Does b force the loading of a and/or c because of :after and the mixed
>> :demand/:defer? Or is b forced to defer?
>
> a will be loaded immediately after b is loaded.
> b will be loaded immediately after c is loaded.
Are you implying that b is (effectively?) deferred until after c? Or,
another way of saying it is that demand/defer has no meaning when after
is applied to the package (c controls demand/defer).
>> The potential (lack of?) side-effects here should be mentioned as it
>> might effect on :config for a, b, or c.
>
> Sorry, I don't understand this.
I'm overthinking (I think).
The statement ":defer/:demand has no meaning when :after is used -- the
package will be loaded immediately after the listed packages" makes
sense to me.
I haven't used them yet, but should something like this also be said for
:if and :requires?
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-15 11:42 ` Eli Zaretskii
@ 2023-05-15 22:27 ` David Masterson
2023-05-16 16:19 ` Eli Zaretskii
0 siblings, 1 reply; 37+ messages in thread
From: David Masterson @ 2023-05-15 22:27 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: David Masterson <dsmasterson@gmail.com>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Sun, 14 May 2023 23:16:52 -0700
>>
>> If a, b, and c were all ':defer t' and a had ':bind ("C-." . b-mode)'
>> and I later hit that key, that would load c, then b, then a -- right?
>
> No, based on my reading of the docs I think it will cause an error
> (because b cannot be loaded without c being loaded).
D**n typo -- it should've been 'a-mode'. But, as I wrote it, I think
you're right. My question was that the :bind key would force the load
of the bottom of the tree and the :afters would then force loading of
the parent packages.
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-15 22:19 ` David Masterson
@ 2023-05-16 16:16 ` Eli Zaretskii
0 siblings, 0 replies; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-16 16:16 UTC (permalink / raw)
To: help-gnu-emacs
> From: David Masterson <dsmasterson@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Mon, 15 May 2023 15:19:59 -0700
>
> >> (use-package a :defer t :after b)
> >> (use-package b :demand t :after c)
> >> (use-package c :defer t)
> >>
> >> Does b force the loading of a and/or c because of :after and the mixed
> >> :demand/:defer? Or is b forced to defer?
> >
> > a will be loaded immediately after b is loaded.
> > b will be loaded immediately after c is loaded.
>
> Are you implying that b is (effectively?) deferred until after c? Or,
> another way of saying it is that demand/defer has no meaning when after
> is applied to the package (c controls demand/defer).
Yes, that is my reading of the docs.
> The statement ":defer/:demand has no meaning when :after is used -- the
> package will be loaded immediately after the listed packages" makes
> sense to me.
>
> I haven't used them yet, but should something like this also be said for
> :if and :requires?
Isn't that clear from their description?
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-15 22:27 ` David Masterson
@ 2023-05-16 16:19 ` Eli Zaretskii
2023-05-16 20:44 ` David Masterson
0 siblings, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-16 16:19 UTC (permalink / raw)
To: help-gnu-emacs
> From: David Masterson <dsmasterson@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Mon, 15 May 2023 15:27:53 -0700
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> >> From: David Masterson <dsmasterson@gmail.com>
> >> Cc: help-gnu-emacs@gnu.org
> >> Date: Sun, 14 May 2023 23:16:52 -0700
> >>
> >> If a, b, and c were all ':defer t' and a had ':bind ("C-." . b-mode)'
> >> and I later hit that key, that would load c, then b, then a -- right?
> >
> > No, based on my reading of the docs I think it will cause an error
> > (because b cannot be loaded without c being loaded).
>
> D**n typo -- it should've been 'a-mode'.
I don't think it matters. AFAIU, :bind doesn't load the package
except via explicit autoloads (i.e. not via use-package machinery).
> My question was that the :bind key would force the load of the
> bottom of the tree and the :afters would then force loading of the
> parent packages.
:after cannot force loading the parents, AFAIU. I don't understand
why you think it should (or could).
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-16 16:19 ` Eli Zaretskii
@ 2023-05-16 20:44 ` David Masterson
2023-05-17 1:40 ` David Masterson
2023-05-17 11:42 ` Eli Zaretskii
0 siblings, 2 replies; 37+ messages in thread
From: David Masterson @ 2023-05-16 20:44 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: David Masterson <dsmasterson@gmail.com>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Mon, 15 May 2023 15:27:53 -0700
>>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>> >> From: David Masterson <dsmasterson@gmail.com>
>> >> Cc: help-gnu-emacs@gnu.org
>> >> Date: Sun, 14 May 2023 23:16:52 -0700
>> >>
>> >> If a, b, and c were all ':defer t' and a had ':bind ("C-." . b-mode)'
>> >> and I later hit that key, that would load c, then b, then a -- right?
>> >
>> > No, based on my reading of the docs I think it will cause an error
>> > (because b cannot be loaded without c being loaded).
>>
>> D**n typo -- it should've been 'a-mode'.
>
> I don't think it matters. AFAIU, :bind doesn't load the package
> except via explicit autoloads (i.e. not via use-package machinery).
I think we're saying the same thing. The bound key will call 'a-mode
which will trigger the autoload setup by use-package because a was
deferred.
>> My question was that the :bind key would force the load of the
>> bottom of the tree and the :afters would then force loading of the
>> parent packages.
>
> :after cannot force loading the parents, AFAIU. I don't understand
> why you think it should (or could).
The :after(s) say there is a relationship between a, b, and c --
presumably, in the user's setup, a won't be used without b (same w/
b->c). Therefore, if the :after on a doesn't kick the loading of the
deferred b, then it must be assumed that a does (require 'b) (and
similar b->c) in which case is there a need for :after? Each package
would handle it internally via 'require'.
I'm assuming there is a reason for :after in the case where a, b, and c
are not directly related (ie. no internal requires), but are related
because of the user's environment. For instance, a (made up) example
might be when the user brings in (say) a specialized spell checker then
he's going to work with Org (ie. (use-package checker :after org)). In
this case, the spell checker would hook itself into Org -- Org would not
know anything else about it.
Does that make sense?
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-16 20:44 ` David Masterson
@ 2023-05-17 1:40 ` David Masterson
2023-05-17 11:42 ` Eli Zaretskii
1 sibling, 0 replies; 37+ messages in thread
From: David Masterson @ 2023-05-17 1:40 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
David Masterson <dsmasterson@gmail.com> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: David Masterson <dsmasterson@gmail.com>
>>> Cc: help-gnu-emacs@gnu.org
>>> Date: Mon, 15 May 2023 15:27:53 -0700
>>>
>>> Eli Zaretskii <eliz@gnu.org> writes:
>>>
>>> >> From: David Masterson <dsmasterson@gmail.com>
>>> >> Cc: help-gnu-emacs@gnu.org
>>> >> Date: Sun, 14 May 2023 23:16:52 -0700
>>> >>
>>> >> If a, b, and c were all ':defer t' and a had ':bind ("C-." . b-mode)'
>>> >> and I later hit that key, that would load c, then b, then a -- right?
>>> >
>>> > No, based on my reading of the docs I think it will cause an error
>>> > (because b cannot be loaded without c being loaded).
>>>
>>> D**n typo -- it should've been 'a-mode'.
>>
>> I don't think it matters. AFAIU, :bind doesn't load the package
>> except via explicit autoloads (i.e. not via use-package machinery).
>
> I think we're saying the same thing. The bound key will call 'a-mode
> which will trigger the autoload setup by use-package because a was
> deferred.
>
>>> My question was that the :bind key would force the load of the
>>> bottom of the tree and the :afters would then force loading of the
>>> parent packages.
>>
>> :after cannot force loading the parents, AFAIU. I don't understand
>> why you think it should (or could).
>
> The :after(s) say there is a relationship between a, b, and c --
> presumably, in the user's setup, a won't be used without b (same w/
> b->c). Therefore, if the :after on a doesn't kick the loading of the
> deferred b, then it must be assumed that a does (require 'b) (and
> similar b->c) in which case is there a need for :after? Each package
> would handle it internally via 'require'.
>
> I'm assuming there is a reason for :after in the case where a, b, and c
> are not directly related (ie. no internal requires), but are related
> because of the user's environment. For instance, a (made up) example
> might be when the user brings in (say) a specialized spell checker then
> he's going to work with Org (ie. (use-package checker :after org)). In
> this case, the spell checker would hook itself into Org -- Org would not
> know anything else about it.
>
> Does that make sense?
Ultimately, I think two statements should be made about :after in the
documentation:
1. :demand/:defer are meaningless when :after is present.
2. :after ensures that the current package is loaded after the listed
packages (which is different than failing if the listed packages are
not already loaded when loading the current package). The current
package may load immediately because the listed packages are already
loaded or use-package will setup "magic" to autoload this package
when the listed packages have been loaded.
That's a little more wordy than I wanted.
With respect to :requires, it's explicitly says that it happens at time
of use-package call which is fine.
With respect to :if (etc.), it doesn't explicitly say, but it's implied
by the docs for :requires. It should probably be explicit.
Does this make sense?
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-16 20:44 ` David Masterson
2023-05-17 1:40 ` David Masterson
@ 2023-05-17 11:42 ` Eli Zaretskii
2023-05-17 20:30 ` David Masterson
1 sibling, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-17 11:42 UTC (permalink / raw)
To: help-gnu-emacs
> From: David Masterson <dsmasterson@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Tue, 16 May 2023 13:44:25 -0700
>
> > :after cannot force loading the parents, AFAIU. I don't understand
> > why you think it should (or could).
>
> The :after(s) say there is a relationship between a, b, and c --
> presumably, in the user's setup, a won't be used without b (same w/
> b->c).
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.
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-17 11:42 ` Eli Zaretskii
@ 2023-05-17 20:30 ` David Masterson
2023-05-18 10:36 ` Eli Zaretskii
0 siblings, 1 reply; 37+ messages in thread
From: David Masterson @ 2023-05-17 20:30 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> From: David Masterson <dsmasterson@gmail.com>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Tue, 16 May 2023 13:44:25 -0700
>>
>> > :after cannot force loading the parents, AFAIU. I don't understand
>> > why you think it should (or could).
>>
>> The :after(s) say there is a relationship between a, b, and c --
>> presumably, in the user's setup, a won't be used without b (same w/
>> b->c).
>
> 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? :bind is one of the triggers to autoload the
package (a in this case), so this would be unexpected.
In your mind, what is the use-case for :after? If there is a
requirement that a must have b, you would expect a to require b
internally (no need for after). If it is a user desire that, when he
uses a, he will also want b, then, if b is not loaded by the :after, the
user would have to use :config to require b defeating the need for
:after.
Am I missing something?!? 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)?
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-17 20:30 ` David Masterson
@ 2023-05-18 10:36 ` Eli Zaretskii
2023-05-18 12:41 ` Lynn Winebarger
2023-05-19 3:03 ` David Masterson
0 siblings, 2 replies; 37+ messages in thread
From: Eli Zaretskii @ 2023-05-18 10:36 UTC (permalink / raw)
To: help-gnu-emacs
> 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.
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-18 10:36 ` Eli Zaretskii
@ 2023-05-18 12:41 ` Lynn Winebarger
2023-05-19 2:40 ` David Masterson
2023-05-19 3:03 ` David Masterson
1 sibling, 1 reply; 37+ messages in thread
From: Lynn Winebarger @ 2023-05-18 12:41 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
On Thu, May 18, 2023 at 6:36 AM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: David Masterson <dsmasterson@gmail.com>
> > 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.
Hi, David,
If you're looking for practical guidance on how emacs maintainers
create and manage tests, you may find test/README and admin/notes/emba
useful.
Lynn
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-18 12:41 ` Lynn Winebarger
@ 2023-05-19 2:40 ` David Masterson
0 siblings, 0 replies; 37+ messages in thread
From: David Masterson @ 2023-05-19 2:40 UTC (permalink / raw)
To: Lynn Winebarger; +Cc: Eli Zaretskii, help-gnu-emacs
Lynn Winebarger <owinebar@gmail.com> writes:
> On Thu, May 18, 2023 at 6:36 AM Eli Zaretskii <eliz@gnu.org> wrote:
>> > From: David Masterson <dsmasterson@gmail.com>
>> > 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.
>
> Hi, David,
> If you're looking for practical guidance on how emacs maintainers
> create and manage tests, you may find test/README and admin/notes/emba
> useful.
Thanks for the thought. Where are these files?
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: use-package :after ??
2023-05-18 10:36 ` Eli Zaretskii
2023-05-18 12:41 ` Lynn Winebarger
@ 2023-05-19 3:03 ` David Masterson
1 sibling, 0 replies; 37+ messages in thread
From: David Masterson @ 2023-05-19 3:03 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> 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.
Ahh, a test is needed to determine how to adjust the docs to better
explain this without getting into the ELisp weeds.
>> :bind is one of the triggers to autoload the
>> package (a in this case), so this would be unexpected.
>
> Which part is unexpected?
Maybe it's my reading. I read :after as a requirement that use-package
could enforce by loading b (if necessary) for a at the appropriate time.
You seem to be reading it as a requirement that, if not met already,
will cause an error of some sort. I suppose my view would be
eval-before-load (which doesn't exist) whereas yours fits
eval-after-load.
>> 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.
Yeah, I had assumed use-package was a little more elegant than that as
it had (via :after) all the info needed to know what should be loaded to
go with the current package load.
As I get more time, I'll play with ERT around this.
Thanks
--
David Masterson
^ permalink raw reply [flat|nested] 37+ messages in thread
end of thread, other threads:[~2023-05-19 3:03 UTC | newest]
Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-08 0:05 use-package :after ?? David Masterson
2023-05-08 2:44 ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-05-08 4:05 ` David Masterson
2023-05-08 4:25 ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-05-08 5:20 ` David Masterson
2023-05-08 12:19 ` Eli Zaretskii
2023-05-10 23:56 ` David Masterson
2023-05-11 3:24 ` David Masterson
2023-05-11 6:14 ` Eli Zaretskii
2023-05-11 21:24 ` David Masterson
2023-05-12 1:18 ` Ruijie Yu via Users list for the GNU Emacs text editor
2023-05-12 6:33 ` Eli Zaretskii
2023-05-12 6:38 ` Emanuel Berg
2023-05-12 5:59 ` Eli Zaretskii
2023-05-12 6:54 ` David Masterson
2023-05-12 7:22 ` Eli Zaretskii
2023-05-15 6:03 ` David Masterson
2023-05-15 11:36 ` Eli Zaretskii
2023-05-15 22:19 ` David Masterson
2023-05-16 16:16 ` Eli Zaretskii
[not found] ` <87pm72m8rc.fsf@penguin>
2023-05-15 6:16 ` David Masterson
2023-05-15 11:42 ` Eli Zaretskii
2023-05-15 22:27 ` David Masterson
2023-05-16 16:19 ` Eli Zaretskii
2023-05-16 20:44 ` David Masterson
2023-05-17 1:40 ` David Masterson
2023-05-17 11:42 ` Eli Zaretskii
2023-05-17 20:30 ` David Masterson
2023-05-18 10:36 ` Eli Zaretskii
2023-05-18 12:41 ` Lynn Winebarger
2023-05-19 2:40 ` David Masterson
2023-05-19 3:03 ` David Masterson
2023-05-11 5:54 ` Eli Zaretskii
2023-05-11 22:04 ` David Masterson
2023-05-12 6:14 ` Eli Zaretskii
2023-05-12 6:31 ` Emanuel Berg
2023-05-12 6:56 ` David Masterson
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.