diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-09-06 13:52:54 +0100 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-09-07 11:22:30 +0100 |
commit | 066b26d6c47d1384d5ed3ce09c6379a9df350256 (patch) | |
tree | 838c91df120a3238f0cebcc5740a3ed18bbc3068 /lisp/emacs-lisp | |
parent | 1a0b4791061aafac84e24946f8af48b423344021 (diff) | |
download | emacs-066b26d6c47d1384d5ed3ce09c6379a9df350256.tar.gz emacs-066b26d6c47d1384d5ed3ce09c6379a9df350256.tar.bz2 emacs-066b26d6c47d1384d5ed3ce09c6379a9df350256.zip |
* 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
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/package.el | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 4d3678a1034..23247d78019 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) |