diff options
| author | Artur Malabarba | 2014-12-13 12:25:31 +0000 |
|---|---|---|
| committer | Artur Malabarba | 2014-12-13 12:31:20 +0000 |
| commit | c13baa10d55ec863d3ceaea48c6b2959ece98198 (patch) | |
| tree | f9b6cddefd4e8f7724641f8b131ceb235d546786 | |
| parent | afd801f9a7a5e025394d89dae798ac81bfc2d46d (diff) | |
| download | emacs-c13baa10d55ec863d3ceaea48c6b2959ece98198.tar.gz emacs-c13baa10d55ec863d3ceaea48c6b2959ece98198.zip | |
emacs-lisp/package.el (package-activate-1): Reload package after upgrade
After installing a package, reloads files returned by
`package--list-loaded-files'.
Fix bug#10125, bug#18443, and bug#18448.
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 20 |
2 files changed, 18 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bc34066d001..afe4b355c79 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | * emacs-lisp/package.el (package--list-loaded-files): New function | 3 | * emacs-lisp/package.el (package--list-loaded-files): New function |
| 4 | to list files in a given directory which correspond to already | 4 | to list files in a given directory which correspond to already |
| 5 | loaded files. | 5 | loaded files. |
| 6 | (package-activate-1): Reload files given by `package--list-loaded-files'. | ||
| 7 | Fix bug#10125, bug#18443, and bug#18448. | ||
| 6 | 8 | ||
| 7 | 2014-12-13 Eric S. Raymond <esr@snark.thyrsus.com> | 9 | 2014-12-13 Eric S. Raymond <esr@snark.thyrsus.com> |
| 8 | 10 | ||
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 654ad3aa3a5..e424e30de1f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -524,15 +524,27 @@ Return the max version (as a string) if the package is held at a lower version." | |||
| 524 | (error "Internal error: unable to find directory for `%s'" | 524 | (error "Internal error: unable to find directory for `%s'" |
| 525 | (package-desc-full-name pkg-desc))) | 525 | (package-desc-full-name pkg-desc))) |
| 526 | ;; Add to load path, add autoloads, and activate the package. | 526 | ;; Add to load path, add autoloads, and activate the package. |
| 527 | (let ((old-lp load-path)) | 527 | (let* ((old-lp load-path) |
| 528 | (with-demoted-errors | 528 | (autoloads-file (expand-file-name |
| 529 | (load (expand-file-name (format "%s-autoloads" name) pkg-dir) nil t)) | 529 | (format "%s-autoloads" name) pkg-dir)) |
| 530 | (loaded-files-list (package--list-loaded-files pkg-dir))) | ||
| 531 | (with-demoted-errors (format "Error loading %s: %%s" name) | ||
| 532 | (load autoloads-file nil t)) | ||
| 530 | (when (and (eq old-lp load-path) | 533 | (when (and (eq old-lp load-path) |
| 531 | (not (or (member pkg-dir load-path) | 534 | (not (or (member pkg-dir load-path) |
| 532 | (member pkg-dir-dir load-path)))) | 535 | (member pkg-dir-dir load-path)))) |
| 533 | ;; Old packages don't add themselves to the `load-path', so we have to | 536 | ;; Old packages don't add themselves to the `load-path', so we have to |
| 534 | ;; do it ourselves. | 537 | ;; do it ourselves. |
| 535 | (push pkg-dir load-path))) | 538 | (push pkg-dir load-path)) |
| 539 | ;; Call `load' on all files in `pkg-dir' already present in | ||
| 540 | ;; `load-history'. This is done so that macros in these files are updated | ||
| 541 | ;; to their new definitions. If another package is being installed which | ||
| 542 | ;; depends on this new definition, not doing this update would cause | ||
| 543 | ;; compilation errors and break the installation. | ||
| 544 | (with-demoted-errors (format "Error loading %s: %%s" name) | ||
| 545 | (mapc (lambda (feature) (load feature nil t)) | ||
| 546 | ;; Skip autoloads file since we already evaluated it above. | ||
| 547 | (remove (file-truename autoloads-file) loaded-files-list)))) | ||
| 536 | ;; Add info node. | 548 | ;; Add info node. |
| 537 | (when (file-exists-p (expand-file-name "dir" pkg-dir)) | 549 | (when (file-exists-p (expand-file-name "dir" pkg-dir)) |
| 538 | ;; FIXME: not the friendliest, but simple. | 550 | ;; FIXME: not the friendliest, but simple. |