aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2020-12-18 10:02:15 -0500
committerStefan Monnier2020-12-18 10:02:15 -0500
commiteeade2b64767bfce9118eae36c25363a7fb6ea76 (patch)
tree1df0065dbd14c7e23f4dfcda164d5d48fef07b43
parenteaea03546a291e27c5794599040b8bb464118d9f (diff)
downloademacs-eeade2b64767bfce9118eae36c25363a7fb6ea76.tar.gz
emacs-eeade2b64767bfce9118eae36c25363a7fb6ea76.zip
* lisp/emacs-lisp/package.el: Byte compile the quickstart file
Earlier tests had found problems when byte-compiling the file, but later investigations indicated the problem was not directly related. The performance difference is appreciable. (package-quickstart-refresh): Byte compile the file. (package-activate-all): Load byte-compiled version if available. (package--quickstart-maybe-refresh): Delete the byte-compiled file as well.
-rw-r--r--lisp/emacs-lisp/package.el32
1 files changed, 19 insertions, 13 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index b7c48dfd3f5..f6ad6d2ebc7 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1615,18 +1615,22 @@ that code in the early init-file."
1615 "Activate all installed packages. 1615 "Activate all installed packages.
1616The variable `package-load-list' controls which packages to load." 1616The variable `package-load-list' controls which packages to load."
1617 (setq package--activated t) 1617 (setq package--activated t)
1618 (if (file-readable-p package-quickstart-file) 1618 (let* ((elc (concat package-quickstart-file "c"))
1619 ;; Skip load-source-file-function which would slow us down by a factor 1619 (qs (if (file-readable-p elc) elc
1620 ;; 2 (this assumes we were careful to save this file so it doesn't need 1620 (if (file-readable-p package-quickstart-file)
1621 ;; any decoding). 1621 package-quickstart-file))))
1622 (let ((load-source-file-function nil)) 1622 (if qs
1623 (load package-quickstart-file nil 'nomessage)) 1623 ;; Skip load-source-file-function which would slow us down by a factor
1624 (dolist (elt (package--alist)) 1624 ;; 2 when loading the .el file (this assumes we were careful to
1625 (condition-case err 1625 ;; save this file so it doesn't need any decoding).
1626 (package-activate (car elt)) 1626 (let ((load-source-file-function nil))
1627 ;; Don't let failure of activation of a package arbitrarily stop 1627 (load qs nil 'nomessage))
1628 ;; activation of further packages. 1628 (dolist (elt (package--alist))
1629 (error (message "%s" (error-message-string err))))))) 1629 (condition-case err
1630 (package-activate (car elt))
1631 ;; Don't let failure of activation of a package arbitrarily stop
1632 ;; activation of further packages.
1633 (error (message "%s" (error-message-string err))))))))
1630 1634
1631;;;; Populating `package-archive-contents' from archives 1635;;;; Populating `package-archive-contents' from archives
1632;; This subsection populates the variables listed above from the 1636;; This subsection populates the variables listed above from the
@@ -4041,6 +4045,7 @@ activations need to be changed, such as when `package-load-list' is modified."
4041 ;; FIXME: Delay refresh in case we're installing/deleting 4045 ;; FIXME: Delay refresh in case we're installing/deleting
4042 ;; several packages! 4046 ;; several packages!
4043 (package-quickstart-refresh) 4047 (package-quickstart-refresh)
4048 (delete-file (concat package-quickstart-file "c"))
4044 (delete-file package-quickstart-file))) 4049 (delete-file package-quickstart-file)))
4045 4050
4046(defun package-quickstart-refresh () 4051(defun package-quickstart-refresh ()
@@ -4098,7 +4103,8 @@ activations need to be changed, such as when `package-load-list' is modified."
4098;;\sno-byte-compile: t 4103;;\sno-byte-compile: t
4099;; no-update-autoloads: t 4104;; no-update-autoloads: t
4100;; End: 4105;; End:
4101")))) 4106"))
4107 (byte-compile-file package-quickstart-file)))
4102 4108
4103(defun package--imenu-prev-index-position-function () 4109(defun package--imenu-prev-index-position-function ()
4104 "Move point to previous line in package-menu buffer. 4110 "Move point to previous line in package-menu buffer.