Dear all,

In January 2018, we added support for an early init-file to Emacs 27,
and adjusted Emacs startup to invoke `package-initialize' before
loading the standard init-file (but after loading the early
init-file). This change was adopted, at my suggestion, in order to
obviate the need for `package-initialize' being called in the user's
init-file, and to remove the feature by which Emacs added the call
automatically (which had various disadvantages).

The problem with this change is that many existing init-files contain
a call to `package-initialize', meaning that the function is called
twice during startup. Currently, a warning is emitted when this
occurs. However, there is a better way to solve the problem: simply do
nothing the second time `package-initialize' is invoked.

The problem with this approach is that sometimes it will change the
behavior of an existing Emacs configuration. If an advanced user
changes the values of `package-load-list', `package-user-dir', and/or
`package-directory-list' in their init-file, and they subsequently
call `package-initialize', then ignoring this call will lead to wrong
behavior.

However, it is easy to address this complication: simply keep track of
the values of these user options. If one or more of them has changed
since the last time `package-initialize' was invoked, then perform the
initialization a second time (and signal a warning).

This strategy should be an improvement in user experience for every
use case of package.el, but especially for inexperienced users who may
not even be aware that the package system requires initialization.

I have attached a patch which implements the behavior described above.
The new warning looks like this:

Warning (package): Package.el reinitialized with changed value for ‘package-user-dir’ ("~/.emacs.d/elpa" -> "~/.emacs.d/elpa-alt")

Feedback is welcome. Please copy me on replies, since I am not
subscribed to emacs-devel.

Best regards,
Radon Rosborough