Commit 066b26d6 authored by Artur Malabarba's avatar Artur Malabarba
Browse files

* lisp/emacs-lisp/package.el (package-initialize): Set enable-at-startup

When `package-initialize' is called as part of loading the init file,
the user probably doesn't want it to be called again afterwards. In this
situation, `package-initialize' now sets `package-enable-at-startup' to
nil to prevent that. The user can have the old behaviour by setting this
variable to t after the call to `package-initialize'.  (Bug#21423)

* doc/emacs/package.texi (Package Installation): Document it

* doc/lispref/package.texi (Packaging Basics): Document it

* etc/NEWS: Document it
parent 1a0b4791
......@@ -232,7 +232,7 @@ in your init file depends on a package). In that case, your init file
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
......@@ -113,8 +113,10 @@ package loading is disabled if the user option
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
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
......@@ -856,6 +856,13 @@ a typographically-correct documents.
* 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
** `: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.
......@@ -1372,13 +1372,18 @@ If successful, set `package-archive-contents'."
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."
(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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment