diff options
| author | Dmitry Gutov | 2014-12-18 12:10:34 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2014-12-18 12:10:34 +0200 |
| commit | 18d4bdf135524f33173caa2ef2164345bd09017d (patch) | |
| tree | 586980465aca076d257afe75c7574b0653a56257 | |
| parent | 9e77c1b7bcfd0807be7fe67daf73c2320e864309 (diff) | |
| download | emacs-18d4bdf135524f33173caa2ef2164345bd09017d.tar.gz emacs-18d4bdf135524f33173caa2ef2164345bd09017d.zip | |
Don't reload packages at startup
Fixes: debbugs:19390
* lisp/emacs-lisp/package.el (package-activate-1): Add RELOAD argument
and a docstring.
(package-activate): Call itself on dependencies on PACKAGE with
the same FORCE argument. Pass FORCE as RELOAD into
`package-activate-1' .
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 12 |
2 files changed, 16 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 87c39447d0c..0d5cdd1f848 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2014-12-18 Dmitry Gutov <dgutov@yandex.ru> | ||
| 2 | |||
| 3 | * emacs-lisp/package.el (package-activate-1): Add RELOAD argument | ||
| 4 | and a docstring. | ||
| 5 | (package-activate): Call itself on dependencies on PACKAGE with | ||
| 6 | the same FORCE argument. Pass FORCE as RELOAD into | ||
| 7 | `package-activate-1' (bug#19390). | ||
| 8 | |||
| 1 | 2014-12-17 Sam Steingold <sds@gnu.org> | 9 | 2014-12-17 Sam Steingold <sds@gnu.org> |
| 2 | 10 | ||
| 3 | * emacs-lisp/package.el (package--list-loaded-files): Handle | 11 | * emacs-lisp/package.el (package--list-loaded-files): Handle |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 199eac5cf6c..1949d0d474c 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -516,7 +516,11 @@ Return the max version (as a string) if the package is held at a lower version." | |||
| 516 | force)) | 516 | force)) |
| 517 | (t (error "Invalid element in `package-load-list'"))))) | 517 | (t (error "Invalid element in `package-load-list'"))))) |
| 518 | 518 | ||
| 519 | (defun package-activate-1 (pkg-desc) | 519 | (defun package-activate-1 (pkg-desc &optional reload) |
| 520 | "Activate package given by PKG-DESC, even if it was already active. | ||
| 521 | If RELOAD is non-nil, also `load' any files inside the package which | ||
| 522 | correspond to previously loaded files (those returned by | ||
| 523 | `package--list-loaded-files')." | ||
| 520 | (let* ((name (package-desc-name pkg-desc)) | 524 | (let* ((name (package-desc-name pkg-desc)) |
| 521 | (pkg-dir (package-desc-dir pkg-desc)) | 525 | (pkg-dir (package-desc-dir pkg-desc)) |
| 522 | (pkg-dir-dir (file-name-as-directory pkg-dir))) | 526 | (pkg-dir-dir (file-name-as-directory pkg-dir))) |
| @@ -527,7 +531,7 @@ Return the max version (as a string) if the package is held at a lower version." | |||
| 527 | (let* ((old-lp load-path) | 531 | (let* ((old-lp load-path) |
| 528 | (autoloads-file (expand-file-name | 532 | (autoloads-file (expand-file-name |
| 529 | (format "%s-autoloads" name) pkg-dir)) | 533 | (format "%s-autoloads" name) pkg-dir)) |
| 530 | (loaded-files-list (package--list-loaded-files pkg-dir))) | 534 | (loaded-files-list (and reload (package--list-loaded-files pkg-dir)))) |
| 531 | (with-demoted-errors (format "Error loading %s: %%s" name) | 535 | (with-demoted-errors (format "Error loading %s: %%s" name) |
| 532 | (load autoloads-file nil t)) | 536 | (load autoloads-file nil t)) |
| 533 | (when (and (eq old-lp load-path) | 537 | (when (and (eq old-lp load-path) |
| @@ -638,14 +642,14 @@ If FORCE is true, (re-)activate it if it's already activated." | |||
| 638 | (fail (catch 'dep-failure | 642 | (fail (catch 'dep-failure |
| 639 | ;; Activate its dependencies recursively. | 643 | ;; Activate its dependencies recursively. |
| 640 | (dolist (req (package-desc-reqs pkg-vec)) | 644 | (dolist (req (package-desc-reqs pkg-vec)) |
| 641 | (unless (package-activate (car req) (cadr req)) | 645 | (unless (package-activate (car req) force) |
| 642 | (throw 'dep-failure req)))))) | 646 | (throw 'dep-failure req)))))) |
| 643 | (if fail | 647 | (if fail |
| 644 | (warn "Unable to activate package `%s'. | 648 | (warn "Unable to activate package `%s'. |
| 645 | Required package `%s-%s' is unavailable" | 649 | Required package `%s-%s' is unavailable" |
| 646 | package (car fail) (package-version-join (cadr fail))) | 650 | package (car fail) (package-version-join (cadr fail))) |
| 647 | ;; If all goes well, activate the package itself. | 651 | ;; If all goes well, activate the package itself. |
| 648 | (package-activate-1 pkg-vec))))))) | 652 | (package-activate-1 pkg-vec force))))))) |
| 649 | 653 | ||
| 650 | (defun define-package (_name-string _version-string | 654 | (defun define-package (_name-string _version-string |
| 651 | &optional _docstring _requirements | 655 | &optional _docstring _requirements |