emacs-devel
[Top][All Lists]
Advanced

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

Re: Calling (package-initialize) sooner during initialization


From: Jorgen Schäfer
Subject: Re: Calling (package-initialize) sooner during initialization
Date: Sun, 12 Apr 2015 14:09:15 +0200

Hello.
I think a major part of the problem here is that package-initialize does
a lot more things than it needs to. All that has to happen before the
user init file is loaded is to load the autoload files from ~/.emacs.d/elpa/.
Everything else can happen on demand or after the init file is loaded,
because it is not necessary to make packages available.

If package.el provided some sort of (package-load-directory DIR), and
ran that on ~/.emacs.d/elpa/, that should fix most use cases already:

> - package-enable-at-startup: Would be equivalent to the proposed
>   environment variable.

That's usually set when the user runs package-initialize manually, but
if the user does not want to enable packages at startup, they can simply
not have anything in ~/.emacs.d/elpa/.

> - package-load-list: Needs to be configured before.

If the user does not want to enable certain packages, they can move
them out of ~/.emacs.d/elpa/. If necessary, they can move the packages
into, say, ~/.emacs.d/held/ and run
(package-load-directory "~/.emacs.d/held") after configuring this variable.

> - package-archives: Needs to be configured before for
>   non-interactive package installation.
> - package-pinned-packages: Needs to be configured before for
>   non-interactive package installation.
> - package-check-signature and package-unsigned-archives: Can be
>   customized afterwards
> - package-directory-list: Needs to be configured before.

These are all only relevant for package installation, not for package
initialization. The user can configure them before installing packages in
their init file, if desired.

> - package-user-dir: Needs to be configured before.

In the new approach, changing this only means the new directory is not
loaded before the user init file is loaded. The user can simply do this
manually using (package-load-directory NEW-DIR) when they need the
new packages, which more or less replicates the current setup of requiring
a package-initialize before packages become available, but arguable more
obvious as the user has to set the variable in their init file already.


That is, Emacs just needs to adjust the load-path and load auto-loads
for the default location before the user init file is run to solve the original
problem of user confusion. None of the config options are necessary for this,
so the race condition that caused the original desire of not running
package-initialize before the user init file is gone. The user can set the
config options as necessary in their init file while simply using packages as
expected.

Regards,
Jorgen



reply via email to

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