emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question: loading code when two packages are load?


From: Karl Fogel
Subject: Re: Question: loading code when two packages are load?
Date: Wed, 08 Sep 2021 23:25:58 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On 09 Sep 2021, Qiantan Hong wrote:
- Put the code inside an `with-eval-after-load`.

Thanks! This looks like exactly what I need.
I don’t understand why the manual says
"well-designed Lisp programs should not use with-eval-after-load”
and advocate for using require though. Isn’t with-eval-after-load exactly the lazy counterpart of require?

TIL ("Today I Learned") about `with-eval-after-load'! It's a good day :-).

Would the "autoload" facility solve this problem?

To my understanding autoload triggers file loading when function invoked, while in my case I need to invoke function on file loading (to augment the behavior of that file).

Ah -- I should have read more slowly and thoroughly to grok this, sorry.

It sounds like after-load-functions (although eval-after-load works as well
because we just need to target some specific packages),
but somehow manual says it’s an “abnormal hook” which I don’t really understand.

The Hooks for Loading info section seems to try very hard to
talk people out of using itself.

Heh. When using one of those facilities that Emacs has yet discourages the use of, I usually put a comment explaining why it's really the only solution for that particular situation and how therefore this is one of those rare *appropriate* uses.

Best regards,
-Karl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]