diff options
| author | Noam Postavsky | 2017-02-22 21:12:41 -0500 |
|---|---|---|
| committer | Noam Postavsky | 2017-02-26 11:11:40 -0500 |
| commit | 6b6cc56e728a4d8b5ccac86ac393be7cd29207e2 (patch) | |
| tree | a99cac70d53b22f9ac095b0d2d9dedc9eab8d0ec | |
| parent | 2bb467a2e2fc70d387ca9a174d5d3a1417a13008 (diff) | |
| download | emacs-6b6cc56e728a4d8b5ccac86ac393be7cd29207e2.tar.gz emacs-6b6cc56e728a4d8b5ccac86ac393be7cd29207e2.zip | |
Don't call package--ensure-init-file if initialized during startup
* lisp/emacs-lisp/package.el (package-initialize): Check
`after-init-time' rather than `load-file-name' to decide if
`package--ensure-init-file' should be called. Depending on
`load-file-name' will fail if the user calls `pacakge-initialize' in
file which is loaded from the init file (Bug#24643, Bug#25819).
| -rw-r--r-- | lisp/emacs-lisp/package.el | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 6728f1b80b1..8d5fac96cfb 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -1445,13 +1445,13 @@ individual packages after calling `package-initialize' -- this is | |||
| 1445 | taken care of by `package-initialize'." | 1445 | taken care of by `package-initialize'." |
| 1446 | (interactive) | 1446 | (interactive) |
| 1447 | (setq package-alist nil) | 1447 | (setq package-alist nil) |
| 1448 | (if (equal user-init-file load-file-name) | 1448 | (if after-init-time |
| 1449 | ;; If `package-initialize' is being called as part of loading | 1449 | (package--ensure-init-file) |
| 1450 | ;; the init file, it's obvious we don't need to ensure-init. | 1450 | ;; If `package-initialize' is before we finished loading the init |
| 1451 | (setq package--init-file-ensured t | 1451 | ;; file, it's obvious we don't need to ensure-init. |
| 1452 | ;; And likely we don't need to run it again after init. | 1452 | (setq package--init-file-ensured t |
| 1453 | package-enable-at-startup nil) | 1453 | ;; And likely we don't need to run it again after init. |
| 1454 | (package--ensure-init-file)) | 1454 | package-enable-at-startup nil)) |
| 1455 | (package-load-all-descriptors) | 1455 | (package-load-all-descriptors) |
| 1456 | (package-read-all-archive-contents) | 1456 | (package-read-all-archive-contents) |
| 1457 | (unless no-activate | 1457 | (unless no-activate |