diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-05-15 10:54:48 +0100 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-05-15 11:18:53 +0100 |
commit | 2abfe21de9241aea36f7221184886b6b39f7648b (patch) | |
tree | 806b483eb7ec68c4496dc91952b13eefbaab9877 /lisp/emacs-lisp/package.el | |
parent | 67a878f78f879ce534232408c34dd11f42dd802b (diff) | |
download | emacs-2abfe21de9241aea36f7221184886b6b39f7648b.tar.gz emacs-2abfe21de9241aea36f7221184886b6b39f7648b.tar.bz2 emacs-2abfe21de9241aea36f7221184886b6b39f7648b.zip |
* lisp/emacs-lisp/package.el: Don't ensure-init during startup
(package--init-file-ensured): New variable.
(package-initialize, package--ensure-init-file): Use it.
Diffstat (limited to 'lisp/emacs-lisp/package.el')
-rw-r--r-- | lisp/emacs-lisp/package.el | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 1d27bf752df..55fa962719d 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -1346,6 +1346,9 @@ If successful, set `package-archive-contents'." ;; available on disk. (defvar package--initialized nil) +(defvar package--init-file-ensured nil + "Whether we know the init file has package-initialize.") + ;;;###autoload (defun package-initialize (&optional no-activate) "Load Emacs Lisp packages, and activate them. @@ -1355,7 +1358,11 @@ If `user-init-file' does not mention `(package-initialize)', add it to the file." (interactive) (setq package-alist nil) - (package--ensure-init-file) + (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) + (package--ensure-init-file)) (package-load-all-descriptors) (package-read-all-archive-contents) (unless no-activate @@ -1802,6 +1809,7 @@ present somewhere in the file, even as a comment. If it is not, add a call to it along with some explanatory comments." ;; Don't mess with the init-file from "emacs -Q". (when (and (stringp user-init-file) + (not package--init-file-ensured) (file-readable-p user-init-file) (file-writable-p user-init-file)) (let* ((buffer (find-buffer-visiting user-init-file)) @@ -1841,7 +1849,8 @@ add a call to it along with some explanatory comments." (let ((file-precious-flag t)) (save-buffer)) (unless buffer - (kill-buffer (current-buffer)))))))))) + (kill-buffer (current-buffer))))))))) + (setq package--init-file-ensured t)) ;;;###autoload (defun package-install (pkg &optional dont-select async callback) |