[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 066b26d: * lisp/emacs-lisp/package.el (package-init
From: |
Artur Malabarba |
Subject: |
[Emacs-diffs] master 066b26d: * lisp/emacs-lisp/package.el (package-initialize): Set enable-at-startup |
Date: |
Mon, 07 Sep 2015 10:23:11 +0000 |
branch: master
commit 066b26d6c47d1384d5ed3ce09c6379a9df350256
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
* 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
---
doc/emacs/package.texi | 2 +-
doc/lispref/package.texi | 6 ++++--
etc/NEWS | 7 +++++++
lisp/emacs-lisp/package.el | 9 +++++++--
4 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index 68913d8..19d861a 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -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
diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi
index f8eba2a..7136286 100644
--- a/doc/lispref/package.texi
+++ b/doc/lispref/package.texi
@@ -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
-Manual}.
+are loaded. If called during startup, this function also sets
address@hidden 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 address@hidden, causes
Emacs to update its record of installed packages without actually
diff --git a/etc/NEWS b/etc/NEWS
index c5148c1..8a08a06 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
+`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.
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 4d3678a..23247d7 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -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."
(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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 066b26d: * lisp/emacs-lisp/package.el (package-initialize): Set enable-at-startup,
Artur Malabarba <=