emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] malabarba/package.el-reload-files-on-upgrade ba1d269 2/2:


From: Artur Malabarba
Subject: [Emacs-diffs] malabarba/package.el-reload-files-on-upgrade ba1d269 2/2: emacs-lisp/package.el (package-activate-1): Reload package files after upgrade.
Date: Thu, 11 Dec 2014 00:12:01 +0000

branch: malabarba/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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]