summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-12-03 15:24:51 +0000
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-12-03 16:13:57 +0000
commit50dce3c4225384cc3705bee4f8e55939f0885f73 (patch)
treed8cc4053a89e803b3ff6e6b8f0694abb019c1f06 /lisp/emacs-lisp
parent67c6906a5f2e79ef771a1d7c8abeb29eb633c659 (diff)
downloademacs-50dce3c4225384cc3705bee4f8e55939f0885f73.tar.gz
emacs-50dce3c4225384cc3705bee4f8e55939f0885f73.tar.bz2
emacs-50dce3c4225384cc3705bee4f8e55939f0885f73.zip
* lisp/emacs-lisp/package.el (package-unpack): Load before compiling
Reload any previously loaded package files before compiling the package (also reload the same files after compiling). This ensures that we have the most recent definitions during compilation, and avoids generating bad elc files when a macro changes and it is used in a different file from the one it's defined in.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/package.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index f94e7aaa741..6b5a2024958 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -830,12 +830,17 @@ untar into a directory named DIR; otherwise, signal an error."
;; Update package-alist.
(let ((new-desc (package-load-descriptor pkg-dir)))
;; FIXME: Check that `new-desc' matches `desc'!
+ ;; Activation has to be done before compilation, so that if we're
+ ;; upgrading and macros have changed we load the new definitions
+ ;; before compiling.
+ (package-activate-1 new-desc :reload :deps)
;; FIXME: Compilation should be done as a separate, optional, step.
;; E.g. for multi-package installs, we should first install all packages
;; and then compile them.
- (package--compile new-desc))
- ;; Try to activate it.
- (package-activate name 'force)
+ (package--compile new-desc)
+ ;; After compilation, load again any files loaded by
+ ;; `activate-1', so that we use the byte-compiled definitions.
+ (package--load-files-for-activation new-desc :reload))
pkg-dir))
(defun package-generate-description-file (pkg-desc pkg-file)