[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/package.el-reload-files-on-upgrade ba1d269 2/6: em
From: |
Artur Malabarba |
Subject: |
[Emacs-diffs] scratch/package.el-reload-files-on-upgrade ba1d269 2/6: emacs-lisp/package.el (package-activate-1): Reload package files after upgrade. |
Date: |
Sat, 13 Dec 2014 02:47:43 +0000 |
branch: scratch/package.el-reload-files-on-upgrade
commit ba1d26966e33389b23da88763bc3f91a2d0f80cd
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
emacs-lisp/package.el (package-activate-1): Reload package files after
upgrade.
After installing a package, reloads files returned by
`package--list-loaded-files'.
(This commit message will be rewritten before merging.)
This should fix #18448 #18443 and #10125, but I'm reluctant to claim
that as I couldn't reproduce the latter and I haven't had a chance to
test the first 2.
---
lisp/ChangeLog | 1 +
lisp/emacs-lisp/package.el | 18 ++++++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6c54dd5..480b949 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,7 @@
* 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'.
2014-12-10 Andreas Schwab <address@hidden>
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 9caa5a2..6c795e1 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -524,15 +524,25 @@ 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 (format "%s-autoloads" name)))
+ (with-demoted-errors (format "Error loading %s: %%s" name)
+ (load (expand-file-name autoloads-file pkg-dir) 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 autoloads-file (package--list-loaded-files pkg-dir)))))
;; Add info node.
(when (file-exists-p (expand-file-name "dir" pkg-dir))
;; FIXME: not the friendliest, but simple.
- [Emacs-diffs] branch scratch/package.el-reload-files-on-upgrade created (now 5675b0a), Artur Malabarba, 2014/12/12
- [Emacs-diffs] scratch/package.el-reload-files-on-upgrade 37cbe15 3/6: Revert accidental deletion of package-built-in-p, Artur Malabarba, 2014/12/12
- [Emacs-diffs] scratch/package.el-reload-files-on-upgrade 300dbb1 1/6: * emacs-lisp/package.el (package--list-loaded-files): New function, Artur Malabarba, 2014/12/12
- [Emacs-diffs] scratch/package.el-reload-files-on-upgrade 93003f1 4/6: Typo, Artur Malabarba, 2014/12/12
- [Emacs-diffs] scratch/package.el-reload-files-on-upgrade 634cc69 5/6: (package-list-loaded-files) A couple of symbol refactorings, Artur Malabarba, 2014/12/12
- [Emacs-diffs] scratch/package.el-reload-files-on-upgrade ba1d269 2/6: emacs-lisp/package.el (package-activate-1): Reload package files after upgrade.,
Artur Malabarba <=
- [Emacs-diffs] scratch/package.el-reload-files-on-upgrade 5675b0a 6/6: (package--list-loaded-files) Return a recursive list of files, Artur Malabarba, 2014/12/12