From: Ihor Radchenko <yantar92@posteo.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: pkg-autoloads.el vs. pkg-loaddefs.el
Date: Mon, 17 Jun 2024 13:45:00 +0000 [thread overview]
Message-ID: <87o77zbs4j.fsf@localhost> (raw)
In-Reply-To: <jwvy177ir2h.fsf-monnier+emacs@gnu.org>
Stefan Monnier via "Emacs development discussions."
<emacs-devel@gnu.org> writes:
> Here's how I see it:
>
> `<pkg>-autoloads.el` is supposed to contain what would have gone into
> `lisp/loaddefs.el` if the package were part of Emacs. I.e. it should
> contain the strict minimum necessary to expose the usual entry points to
> the package: enough that users of the package usually don't need to do
> things like add `require` or touch `auto-mode-alist` in their `.emacs`,
> but not so much that users who *don't* use the package pay an undue cost.
> ELPA packages can be installed without ever being used, just like
> packages bundled with Emacs, and contrary to `lisp/loaddefs.el`,
> `<pkg>-autoloads.el` are loaded at startup so the larger they are, the
> slower Emacs starts up: it's really important to keep them minimal.
Makes sense.
> `<pkg>-loaddefs.el` is not "codified" in the same way, but in practice
> it contains those autoloads *internal* to a package, i.e. loaded only
> once we know the package is being used and typically used to avoid some
> undesirable toplevel `require`s inside the package's files (e.g. to
> avoid circular dependencies, or to load the different subparts of the
> package more lazily). It's fairly normal for such files to be
> significantly larger than the corresponding `<pkg>-autoloads.el`.
Also makes sense.
However, it potentially creates a problem for packages like Org mode
that use _both_ pkg-autoloads.el and pkg-loaddefs.el.
If I understand your explanation correctly, `package-activate' only
loads org-autoloads.el when Org mode is installed from ELPA.
It means that built-in org-loaddefs.el version pre-loaded with Emacs
remains active and any changes in org-loaddefs.el in ELPA Org mode
vs. built-in Org mode are not updated.
In fact, I recently encountered a problem that is very likely caused by
Emacs retaining org-loaddefs.el from built-in Org version. I moved Org
major mode definition to a new library org-mode.el, but M-x org-mode
still insisted on loading org.el, despite new org-loaddefs.el pointing
to org-mode.el.
IMHO, for built-in packages, it seems that pkg-loaddefs _has to be
loaded_ even when the packages is installed via package.el. Otherwise,
we are going to face random breakage every time a function/macro is
relocated to another file or a new function gets autoloaded.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
next prev parent reply other threads:[~2024-06-17 13:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 12:56 pkg-autoloads.el vs. pkg-loaddefs.el Ihor Radchenko
2024-06-14 13:54 ` Stefan Monnier via Emacs development discussions.
2024-06-17 13:45 ` Ihor Radchenko [this message]
2024-06-17 14:04 ` Stefan Monnier
2024-06-18 16:00 ` Ihor Radchenko
2024-06-18 17:23 ` Stefan Monnier
2024-06-18 17:39 ` Ihor Radchenko
2024-06-18 19:43 ` Stefan Monnier
2024-06-18 20:03 ` Ihor Radchenko
2024-06-18 20:12 ` Stefan Monnier
2024-06-19 15:32 ` Ihor Radchenko
2024-06-19 15:58 ` Stefan Monnier
2024-06-19 16:22 ` Ihor Radchenko
2024-06-19 20:35 ` Stefan Monnier
2024-06-20 5:01 ` Eli Zaretskii
2024-07-28 13:52 ` Ihor Radchenko
2024-08-14 0:31 ` Stefan Monnier
2024-08-14 5:43 ` Eli Zaretskii
2024-06-20 15:33 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o77zbs4j.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).