[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master c13baa1 2/2: emacs-lisp/package.el (package-activat
From: |
Artur Malabarba |
Subject: |
[Emacs-diffs] master c13baa1 2/2: emacs-lisp/package.el (package-activate-1): Reload package after upgrade |
Date: |
Sat, 13 Dec 2014 14:32:09 +0000 |
branch: master
commit c13baa10d55ec863d3ceaea48c6b2959ece98198
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
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.
---
lisp/ChangeLog | 2 ++
lisp/emacs-lisp/package.el | 20 ++++++++++++++++----
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bc34066..afe4b35 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,8 @@
* emacs-lisp/package.el (package--list-loaded-files): New function
to list files in a given directory which correspond to already
loaded files.
+ (package-activate-1): Reload files given by
`package--list-loaded-files'.
+ Fix bug#10125, bug#18443, and bug#18448.
2014-12-13 Eric S. Raymond <address@hidden>
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 654ad3a..e424e30 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."
(error "Internal error: unable to find directory for `%s'"
(package-desc-full-name pkg-desc)))
;; Add to load path, add autoloads, and activate the package.
- (let ((old-lp load-path))
- (with-demoted-errors
- (load (expand-file-name (format "%s-autoloads" name) pkg-dir) nil t))
+ (let* ((old-lp load-path)
+ (autoloads-file (expand-file-name
+ (format "%s-autoloads" name) pkg-dir))
+ (loaded-files-list (package--list-loaded-files pkg-dir)))
+ (with-demoted-errors (format "Error loading %s: %%s" name)
+ (load autoloads-file nil t))
(when (and (eq old-lp load-path)
(not (or (member pkg-dir load-path)
(member pkg-dir-dir load-path))))
;; Old packages don't add themselves to the `load-path', so we have to
;; do it ourselves.
- (push pkg-dir load-path)))
+ (push pkg-dir load-path))
+ ;; Call `load' on all files in `pkg-dir' already present in
+ ;; `load-history'. This is done so that macros in these files are
updated
+ ;; to their new definitions. If another package is being installed which
+ ;; depends on this new definition, not doing this update would cause
+ ;; compilation errors and break the installation.
+ (with-demoted-errors (format "Error loading %s: %%s" name)
+ (mapc (lambda (feature) (load feature nil t))
+ ;; Skip autoloads file since we already evaluated it above.
+ (remove (file-truename autoloads-file) loaded-files-list))))
;; Add info node.
(when (file-exists-p (expand-file-name "dir" pkg-dir))
;; FIXME: not the friendliest, but simple.