should call the function @code{package-initialize}. It is up to you
to ensure that relevant user options, such as @code{package-load-list}
(see below), are set up prior to the @code{package-initialize} call.
-You should also set @code{package-enable-at-startup} to @code{nil}, to
+This will automatically set @code{package-enable-at-startup} to @code{nil}, to
avoid loading the packages again after processing the init file.
Alternatively, you may choose to completely inhibit package loading at
startup, and invoke the command @kbd{M-x package-initialize} to load
This function initializes Emacs' internal record of which packages are
installed, and loads them. The user option @code{package-load-list}
specifies which packages to load; by default, all installed packages
-are loaded. @xref{Package Installation,,, emacs, The GNU Emacs
-Manual}.
+are loaded. If called during startup, this function also sets
+@code{package-enable-at-startup} to @code{nil}, to avoid accidentally
+loading the packages twice. @xref{Package Installation,,, emacs, The
+GNU Emacs Manual}.
The optional argument @var{no-activate}, if non-@code{nil}, causes
Emacs to update its record of installed packages without actually
\f
* Incompatible Lisp Changes in Emacs 25.1
++++
+** `package-initialize' now sets `package-enable-at-startup' to nil if
+called during startup. Users who call this function in their init
+file and still expect it to be run after startup should set
+`package-enable-at-startup' to t after the call to
+`package-initialize'.
+
** `:global' minor mode use `setq-default' rather than `setq'.
This means that you can't use `make-local-variable' and expect them to
"magically" become buffer-local.
The variable `package-load-list' controls which packages to load.
If optional arg NO-ACTIVATE is non-nil, don't activate packages.
If `user-init-file' does not mention `(package-initialize)', add
-it to the file."
+it to the file.
+If called as part of loading `user-init-file', set
+`package-enable-at-startup' to nil, to prevent accidentally
+loading packages twice."
(interactive)
(setq package-alist nil)
(if (equal user-init-file load-file-name)
;; If `package-initialize' is being called as part of loading
;; the init file, it's obvious we don't need to ensure-init.
- (setq package--init-file-ensured t)
+ (setq package--init-file-ensured t
+ ;; And likely we don't need to run it again after init.
+ package-enable-at-startup nil)
(package--ensure-init-file))
(package-load-all-descriptors)
(package-read-all-archive-contents)