diff options
| author | Stefan Monnier | 2018-03-26 09:41:30 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2018-03-26 09:41:30 -0400 |
| commit | 6dfdf0c9e8e4aca77b148db8d009c862389c64d3 (patch) | |
| tree | a400cdf3efa473bbf0b39218fbce9bfa61d92aee | |
| parent | b300052fb4ef1261519b0fd57f5eb186c2d10295 (diff) | |
| download | emacs-6dfdf0c9e8e4aca77b148db8d009c862389c64d3.tar.gz emacs-6dfdf0c9e8e4aca77b148db8d009c862389c64d3.zip | |
* lisp/emacs-lisp/package.el: New quickstart feature
(package--quickstart-pkgs): New var.
(package-activate-1): Obey and fill it.
(package-activate-all): New function.
(package-initialize): Call it.
Set package-initialized before activating the packages.
(package-installed-p): Make it work before package.el is initialized in
the case where min-version is not specified.
(package-install, package-delete): Refresh the quickstart if applicable.
(package-quickstart, package-quickstart-file): New vars.
(package--quickstart-maybe-refresh, package-quickstart-refresh):
New functions.
* lisp/startup.el (command-line): Use package-activate-all rather than
package-initialize.
* doc/lispref/package.texi (Packaging Basics):
* doc/emacs/package.texi (Package Installation):
* doc/lispref/os.texi (Startup Summary): Refer to package-activate-all.
| -rw-r--r-- | doc/emacs/custom.texi | 21 | ||||
| -rw-r--r-- | doc/emacs/package.texi | 8 | ||||
| -rw-r--r-- | doc/lispref/os.texi | 6 | ||||
| -rw-r--r-- | doc/lispref/package.texi | 24 | ||||
| -rw-r--r-- | etc/NEWS | 25 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 151 | ||||
| -rw-r--r-- | lisp/files.el | 3 | ||||
| -rw-r--r-- | lisp/startup.el | 2 |
8 files changed, 192 insertions, 48 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index a69888cdbd6..c3cfaabb8d3 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi | |||
| @@ -2602,17 +2602,16 @@ Type @kbd{C-q}, followed by the key you want to bind, to insert @var{char}. | |||
| 2602 | @cindex early init file | 2602 | @cindex early init file |
| 2603 | 2603 | ||
| 2604 | Most customizations for Emacs can be put in the normal init file, | 2604 | Most customizations for Emacs can be put in the normal init file, |
| 2605 | @file{.emacs} or @file{~/.emacs.d/init.el}. However, it is sometimes | 2605 | @file{.emacs} or @file{~/.emacs.d/init.el}. However, it is sometimes desirable |
| 2606 | desirable to have customizations that take effect during Emacs startup | 2606 | to have customizations that take effect during Emacs startup earlier than the |
| 2607 | earlier than the normal init file is processed. Such customizations | 2607 | normal init file is processed. Such customizations can be put in the early |
| 2608 | can be put in the early init file, @file{~/.emacs.d/early-init.el}. | 2608 | init file, @file{~/.emacs.d/early-init.el}. This file is loaded before the |
| 2609 | This file is loaded before the package system is initialized, so in it | 2609 | package system and GUI is initialized, so in it you can customize variables |
| 2610 | you can customize variables that affect the package initialization | 2610 | that affect frame appearance as well as the package initialization process, |
| 2611 | process, such as @code{package-enable-at-startup}, | 2611 | such as @code{package-enable-at-startup}, @code{package-load-list}, and |
| 2612 | @code{package-load-list}, and @code{package-user-dir}. Note that | 2612 | @code{package-user-dir}. Note that variables like @code{package-archives} |
| 2613 | variables like @code{package-archives} which only affect the | 2613 | which only affect the installation of new packages, and not the process of |
| 2614 | installation of new packages, and not the process of making | 2614 | making already-installed packages available, may be customized in the regular |
| 2615 | already-installed packages available, may be customized in the regular | ||
| 2616 | init file. @xref{Package Installation}. | 2615 | init file. @xref{Package Installation}. |
| 2617 | 2616 | ||
| 2618 | For more information on the early init file, @pxref{Init File,,, | 2617 | For more information on the early init file, @pxref{Init File,,, |
diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi index be749348729..43f5a8497d9 100644 --- a/doc/emacs/package.texi +++ b/doc/emacs/package.texi | |||
| @@ -263,13 +263,13 @@ startup, change the variable @code{package-enable-at-startup} to | |||
| 263 | is read before loading the regular init file. Currently this variable | 263 | is read before loading the regular init file. Currently this variable |
| 264 | cannot be set via Customize. | 264 | cannot be set via Customize. |
| 265 | 265 | ||
| 266 | @findex package-initialize | 266 | @findex package-activate-all |
| 267 | If you have set @code{package-enable-at-startup} to @code{nil}, you | 267 | If you have set @code{package-enable-at-startup} to @code{nil}, you |
| 268 | can still make packages available either during or after startup. To | 268 | can still make packages available either during or after startup. To |
| 269 | make installed packages available during startup, call the function | 269 | make installed packages available during startup, call the function |
| 270 | @code{package-initialize} in your init file. To make installed | 270 | @code{package-activate-all} in your init file. To make installed |
| 271 | packages available after startup, invoke the command @kbd{M-x | 271 | packages available after startup, invoke the command @kbd{M-: |
| 272 | package-initialize}. | 272 | (package-activate-all) RET}. |
| 273 | 273 | ||
| 274 | @vindex package-load-list | 274 | @vindex package-load-list |
| 275 | For finer control over which packages are made available at startup, | 275 | For finer control over which packages are made available at startup, |
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 0e30ad519a8..77ecb667f4f 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -103,12 +103,12 @@ was specified, Emacs looks for the init file in that user's home | |||
| 103 | directory instead. | 103 | directory instead. |
| 104 | 104 | ||
| 105 | @item | 105 | @item |
| 106 | It calls the function @code{package-initialize} to activate any | 106 | It calls the function @code{package-activate-all} to activate any |
| 107 | optional Emacs Lisp package that has been installed. @xref{Packaging | 107 | optional Emacs Lisp package that has been installed. @xref{Packaging |
| 108 | Basics}. However, Emacs doesn't initialize packages when | 108 | Basics}. However, Emacs doesn't activate the packages when |
| 109 | @code{package-enable-at-startup} is @code{nil} or when it's started | 109 | @code{package-enable-at-startup} is @code{nil} or when it's started |
| 110 | with one of the options @samp{-q}, @samp{-Q}, or @samp{--batch}. To | 110 | with one of the options @samp{-q}, @samp{-Q}, or @samp{--batch}. To |
| 111 | initialize packages in the latter case, @code{package-initialize} | 111 | activate the packages in the latter case, @code{package-activate-all} |
| 112 | should be called explicitly (e.g., via the @samp{--funcall} option). | 112 | should be called explicitly (e.g., via the @samp{--funcall} option). |
| 113 | 113 | ||
| 114 | @vindex initial-window-system@r{, and startup} | 114 | @vindex initial-window-system@r{, and startup} |
diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi index 7e7a8cd9bc8..37c1ee6697d 100644 --- a/doc/lispref/package.texi +++ b/doc/lispref/package.texi | |||
| @@ -105,16 +105,15 @@ adds the package's content directory to @code{load-path}, and | |||
| 105 | evaluates the autoload definitions in @file{@var{name}-autoloads.el}. | 105 | evaluates the autoload definitions in @file{@var{name}-autoloads.el}. |
| 106 | 106 | ||
| 107 | Whenever Emacs starts up, it automatically calls the function | 107 | Whenever Emacs starts up, it automatically calls the function |
| 108 | @code{package-initialize} to make installed packages available to the | 108 | @code{package-activate-all} to make installed packages available to the |
| 109 | current session. This is done after loading the early init file, but | 109 | current session. This is done after loading the early init file, but |
| 110 | before loading the regular init file (@pxref{Startup Summary}). | 110 | before loading the regular init file (@pxref{Startup Summary}). |
| 111 | Packages are not automatically made available if the user option | 111 | Packages are not automatically made available if the user option |
| 112 | @code{package-enable-at-startup} is set to @code{nil} in the early | 112 | @code{package-enable-at-startup} is set to @code{nil} in the early |
| 113 | init file. | 113 | init file. |
| 114 | 114 | ||
| 115 | @deffn Command package-initialize &optional no-activate | 115 | @defun package-activate-all |
| 116 | This function initializes Emacs' internal record of which packages are | 116 | This function makes the packages available to the current session. |
| 117 | installed, and makes the packages available to the current session. | ||
| 118 | The user option @code{package-load-list} specifies which packages to | 117 | The user option @code{package-load-list} specifies which packages to |
| 119 | make available; by default, all installed packages are made available. | 118 | make available; by default, all installed packages are made available. |
| 120 | If called during startup, this function also sets | 119 | If called during startup, this function also sets |
| @@ -122,15 +121,20 @@ If called during startup, this function also sets | |||
| 122 | evaluating package autoloads more than once. @xref{Package | 121 | evaluating package autoloads more than once. @xref{Package |
| 123 | Installation,,, emacs, The GNU Emacs Manual}. | 122 | Installation,,, emacs, The GNU Emacs Manual}. |
| 124 | 123 | ||
| 125 | The optional argument @var{no-activate}, if non-@code{nil}, causes | 124 | In most cases, you should not need to call @code{package-activate-all}, |
| 126 | Emacs to update its record of installed packages without actually | ||
| 127 | making them available; it is for internal use only. | ||
| 128 | |||
| 129 | In most cases, you should not need to call @code{package-initialize}, | ||
| 130 | as this is done automatically during startup. Simply make sure to put | 125 | as this is done automatically during startup. Simply make sure to put |
| 131 | any code that should run before @code{package-initialize} in the early | 126 | any code that should run before @code{package-activate-all} in the early |
| 132 | init file, and any code that should run after it in the primary init | 127 | init file, and any code that should run after it in the primary init |
| 133 | file (@pxref{Init File,,, emacs, The GNU Emacs Manual}). | 128 | file (@pxref{Init File,,, emacs, The GNU Emacs Manual}). |
| 129 | @end defun | ||
| 130 | |||
| 131 | @deffn Command package-initialize &optional no-activate | ||
| 132 | This function initializes Emacs' internal record of which packages are | ||
| 133 | installed, and then calls @code{package-activate-all}. | ||
| 134 | |||
| 135 | The optional argument @var{no-activate}, if non-@code{nil}, causes | ||
| 136 | Emacs to update its record of installed packages without actually | ||
| 137 | making them available. | ||
| 134 | @end deffn | 138 | @end deffn |
| 135 | 139 | ||
| 136 | @node Simple Packages | 140 | @node Simple Packages |
| @@ -59,14 +59,20 @@ package system is initialized given that initialization now happens | |||
| 59 | before loading the regular init file (see below). | 59 | before loading the regular init file (see below). |
| 60 | 60 | ||
| 61 | +++ | 61 | +++ |
| 62 | ** Emacs now calls 'package-initialize' before loading the init file. | 62 | ** Installed packages are now activated *before* loading the init file. |
| 63 | This is part of a change intended to eliminate the behavior of | 63 | This is part of a change intended to eliminate the behavior of |
| 64 | package.el inserting a call to 'package-initialize' into the init | 64 | package.el inserting a call to 'package-initialize' into the init |
| 65 | file, which was previously done when Emacs was started. As a result | 65 | file, which was previously done when Emacs was started. As a result |
| 66 | of this change, it is no longer necessary to call 'package-initialize' | 66 | of this change, it is no longer necessary to call 'package-initialize' |
| 67 | in your init file. However, if your init file changes the values of | 67 | in your init file. |
| 68 | 'package-load-list' or 'package-user-dir', then that code needs to be | 68 | |
| 69 | moved to the early init file (see above). | 69 | However, if your init file changes the values of 'package-load-list' or |
| 70 | 'package-user-dir', or sets 'package-enable-at-startup' to nil then it won't | ||
| 71 | work right without some adjustment: | ||
| 72 | - you can move that code to the early init file (see above), so those settings | ||
| 73 | apply before Emacs tries to activate the packages. | ||
| 74 | - you can use the new 'package-quickstart` so activation of packages does not | ||
| 75 | need to pay attention to 'package-load-list' or 'package-user-dir' any more. | ||
| 70 | 76 | ||
| 71 | 77 | ||
| 72 | * Changes in Emacs 27.1 | 78 | * Changes in Emacs 27.1 |
| @@ -149,6 +155,17 @@ for abbrevs that have them. | |||
| 149 | It now treats the optional 2nd argument to mean that the URL should be | 155 | It now treats the optional 2nd argument to mean that the URL should be |
| 150 | shown in the currently selected window. | 156 | shown in the currently selected window. |
| 151 | 157 | ||
| 158 | ** Package | ||
| 159 | *** New 'package-quickstart' feature | ||
| 160 | When 'package-quickstart' is non-nil, package.el precomputes a big autoloads | ||
| 161 | file so that activation of packages can be done much faster, which can speed up | ||
| 162 | your startup significantly. | ||
| 163 | It also causes variables like package-user-dir and package-load-list to be | ||
| 164 | consulted when 'package-quickstart-refresh' is run rather than at startup so | ||
| 165 | you don't need to set them in your early init file. | ||
| 166 | |||
| 167 | *** New function 'package-activate-all'. | ||
| 168 | |||
| 152 | ** Ecomplete | 169 | ** Ecomplete |
| 153 | *** The ecomplete sorting has changed to a decay-based algorithm. | 170 | *** The ecomplete sorting has changed to a decay-based algorithm. |
| 154 | This can be controlled by the new `ecomplete-sort-predicate' variable. | 171 | This can be controlled by the new `ecomplete-sort-predicate' variable. |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 67533679b99..b9fdf732ef4 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -681,6 +681,9 @@ PKG-DESC is a `package-desc' object." | |||
| 681 | (defvar Info-directory-list) | 681 | (defvar Info-directory-list) |
| 682 | (declare-function info-initialize "info" ()) | 682 | (declare-function info-initialize "info" ()) |
| 683 | 683 | ||
| 684 | (defvar package--quickstart-pkgs t | ||
| 685 | "If set to a list, we're computing the set of pkgs to activate.") | ||
| 686 | |||
| 684 | (defun package--load-files-for-activation (pkg-desc reload) | 687 | (defun package--load-files-for-activation (pkg-desc reload) |
| 685 | "Load files for activating a package given by PKG-DESC. | 688 | "Load files for activating a package given by PKG-DESC. |
| 686 | Load the autoloads file, and ensure `load-path' is setup. If | 689 | Load the autoloads file, and ensure `load-path' is setup. If |
| @@ -723,7 +726,10 @@ correspond to previously loaded files (those returned by | |||
| 723 | (message "Unable to activate package `%s'.\nRequired package `%s-%s' is unavailable" | 726 | (message "Unable to activate package `%s'.\nRequired package `%s-%s' is unavailable" |
| 724 | name (car req) (package-version-join (cadr req))) | 727 | name (car req) (package-version-join (cadr req))) |
| 725 | (throw 'exit nil)))) | 728 | (throw 'exit nil)))) |
| 726 | (package--load-files-for-activation pkg-desc reload) | 729 | (if (listp package--quickstart-pkgs) |
| 730 | ;; We're only collecting the set of packages to activate! | ||
| 731 | (push pkg-desc package--quickstart-pkgs) | ||
| 732 | (package--load-files-for-activation pkg-desc reload)) | ||
| 727 | ;; Add info node. | 733 | ;; Add info node. |
| 728 | (when (file-exists-p (expand-file-name "dir" pkg-dir)) | 734 | (when (file-exists-p (expand-file-name "dir" pkg-dir)) |
| 729 | ;; FIXME: not the friendliest, but simple. | 735 | ;; FIXME: not the friendliest, but simple. |
| @@ -1463,18 +1469,34 @@ that code in the early init-file." | |||
| 1463 | (setq package-enable-at-startup nil) | 1469 | (setq package-enable-at-startup nil) |
| 1464 | (package-load-all-descriptors) | 1470 | (package-load-all-descriptors) |
| 1465 | (package-read-all-archive-contents) | 1471 | (package-read-all-archive-contents) |
| 1472 | (setq package--initialized t) | ||
| 1466 | (unless no-activate | 1473 | (unless no-activate |
| 1474 | (package-activate-all)) | ||
| 1475 | ;; This uses `package--mapc' so it must be called after | ||
| 1476 | ;; `package--initialized' is t. | ||
| 1477 | (package--build-compatibility-table)) | ||
| 1478 | |||
| 1479 | (defvar package-quickstart-file) | ||
| 1480 | |||
| 1481 | ;;;###autoload | ||
| 1482 | (defun package-activate-all () | ||
| 1483 | "Activate all installed packages. | ||
| 1484 | The variable `package-load-list' controls which packages to load." | ||
| 1485 | (setq package-enable-at-startup nil) | ||
| 1486 | (if (file-readable-p package-quickstart-file) | ||
| 1487 | ;; Skip load-source-file-function which would slow us down by a factor | ||
| 1488 | ;; 2 (this assumes we were careful to save this file so it doesn't need | ||
| 1489 | ;; any decoding). | ||
| 1490 | (let ((load-source-file-function nil)) | ||
| 1491 | (load package-quickstart-file)) | ||
| 1492 | (unless package--initialized | ||
| 1493 | (package-initialize t)) | ||
| 1467 | (dolist (elt package-alist) | 1494 | (dolist (elt package-alist) |
| 1468 | (condition-case err | 1495 | (condition-case err |
| 1469 | (package-activate (car elt)) | 1496 | (package-activate (car elt)) |
| 1470 | ;; Don't let failure of activation of a package arbitrarily stop | 1497 | ;; Don't let failure of activation of a package arbitrarily stop |
| 1471 | ;; activation of further packages. | 1498 | ;; activation of further packages. |
| 1472 | (error (message "%s" (error-message-string err)))))) | 1499 | (error (message "%s" (error-message-string err))))))) |
| 1473 | (setq package--initialized t) | ||
| 1474 | ;; This uses `package--mapc' so it must be called after | ||
| 1475 | ;; `package--initialized' is t. | ||
| 1476 | (package--build-compatibility-table)) | ||
| 1477 | |||
| 1478 | 1500 | ||
| 1479 | ;;;; Populating `package-archive-contents' from archives | 1501 | ;;;; Populating `package-archive-contents' from archives |
| 1480 | ;; This subsection populates the variables listed above from the | 1502 | ;; This subsection populates the variables listed above from the |
| @@ -1856,18 +1878,26 @@ If PACKAGE is a symbol, it is the package name and MIN-VERSION | |||
| 1856 | should be a version list. | 1878 | should be a version list. |
| 1857 | 1879 | ||
| 1858 | If PACKAGE is a `package-desc' object, MIN-VERSION is ignored." | 1880 | If PACKAGE is a `package-desc' object, MIN-VERSION is ignored." |
| 1859 | (unless package--initialized (error "package.el is not yet initialized!")) | 1881 | (cond |
| 1860 | (if (package-desc-p package) | 1882 | ((package-desc-p package) |
| 1861 | (let ((dir (package-desc-dir package))) | 1883 | (let ((dir (package-desc-dir package))) |
| 1862 | (and (stringp dir) | 1884 | (and (stringp dir) |
| 1863 | (file-exists-p dir))) | 1885 | (file-exists-p dir)))) |
| 1886 | ((and (not package--initialized) | ||
| 1887 | (null min-version) | ||
| 1888 | package-activated-list) | ||
| 1889 | ;; We used the quickstart: make it possible to use package-installed-p | ||
| 1890 | ;; even before package is fully initialized. | ||
| 1891 | (memq package package-activated-list)) | ||
| 1892 | ((not package--initialized) (error "package.el is not yet initialized!")) | ||
| 1893 | (t | ||
| 1864 | (or | 1894 | (or |
| 1865 | (let ((pkg-descs (cdr (assq package package-alist)))) | 1895 | (let ((pkg-descs (cdr (assq package package-alist)))) |
| 1866 | (and pkg-descs | 1896 | (and pkg-descs |
| 1867 | (version-list-<= min-version | 1897 | (version-list-<= min-version |
| 1868 | (package-desc-version (car pkg-descs))))) | 1898 | (package-desc-version (car pkg-descs))))) |
| 1869 | ;; Also check built-in packages. | 1899 | ;; Also check built-in packages. |
| 1870 | (package-built-in-p package min-version)))) | 1900 | (package-built-in-p package min-version))))) |
| 1871 | 1901 | ||
| 1872 | (defun package-download-transaction (packages) | 1902 | (defun package-download-transaction (packages) |
| 1873 | "Download and install all the packages in PACKAGES. | 1903 | "Download and install all the packages in PACKAGES. |
| @@ -1918,7 +1948,9 @@ to install it but still mark it as selected." | |||
| 1918 | (package-compute-transaction (list pkg) | 1948 | (package-compute-transaction (list pkg) |
| 1919 | (package-desc-reqs pkg))) | 1949 | (package-desc-reqs pkg))) |
| 1920 | (package-compute-transaction () (list (list pkg)))))) | 1950 | (package-compute-transaction () (list (list pkg)))))) |
| 1921 | (package-download-transaction transaction) | 1951 | (progn |
| 1952 | (package-download-transaction transaction) | ||
| 1953 | (package--quickstart-maybe-refresh)) | ||
| 1922 | (message "`%s' is already installed" name)))) | 1954 | (message "`%s' is already installed" name)))) |
| 1923 | 1955 | ||
| 1924 | (defun package-strip-rcs-id (str) | 1956 | (defun package-strip-rcs-id (str) |
| @@ -2090,7 +2122,9 @@ If NOSAVE is non-nil, the package is not removed from | |||
| 2090 | (delete pkg-desc pkgs) | 2122 | (delete pkg-desc pkgs) |
| 2091 | (unless (cdr pkgs) | 2123 | (unless (cdr pkgs) |
| 2092 | (setq package-alist (delq pkgs package-alist)))) | 2124 | (setq package-alist (delq pkgs package-alist)))) |
| 2093 | (message "Package `%s' deleted." (package-desc-full-name pkg-desc)))))) | 2125 | (package--quickstart-maybe-refresh) |
| 2126 | (message "Package `%s' deleted." | ||
| 2127 | (package-desc-full-name pkg-desc)))))) | ||
| 2094 | 2128 | ||
| 2095 | ;;;###autoload | 2129 | ;;;###autoload |
| 2096 | (defun package-reinstall (pkg) | 2130 | (defun package-reinstall (pkg) |
| @@ -3415,6 +3449,95 @@ The list is displayed in a buffer named `*Packages*'." | |||
| 3415 | (interactive) | 3449 | (interactive) |
| 3416 | (list-packages t)) | 3450 | (list-packages t)) |
| 3417 | 3451 | ||
| 3452 | ;;;; Quickstart: precompute activation actions for faster start up. | ||
| 3453 | |||
| 3454 | ;; Activating packages via `package-initialize' is costly: for N installed | ||
| 3455 | ;; packages, it needs to read all N <pkg>-pkg.el files first to decide | ||
| 3456 | ;; which packages to activate, and then again N <pkg>-autoloads.el files. | ||
| 3457 | ;; To speed this up, we precompute a mega-autoloads file which is the | ||
| 3458 | ;; concatenation of all those <pkg>-autoloads.el, so we can activate | ||
| 3459 | ;; all packages by loading this one file (and hence without initializing | ||
| 3460 | ;; package.el). | ||
| 3461 | |||
| 3462 | ;; Other than speeding things up, this also offers a bootstrap feature: | ||
| 3463 | ;; it lets us activate packages according to package-load-list and | ||
| 3464 | ;; package-user-dir even before those vars are set. | ||
| 3465 | |||
| 3466 | (defcustom package-quickstart nil | ||
| 3467 | "Precompute activation actions to speed up startup. | ||
| 3468 | This requires the use of `package-quickstart-refresh' every time the | ||
| 3469 | activations need to be changed, such as when `package-load-list' is modified." | ||
| 3470 | :type 'boolean) | ||
| 3471 | |||
| 3472 | (defcustom package-quickstart-file | ||
| 3473 | (locate-user-emacs-file "package-quickstart.el") | ||
| 3474 | "Location of the file used to speed up activation of packages at startup." | ||
| 3475 | :type 'file) | ||
| 3476 | |||
| 3477 | (defun package--quickstart-maybe-refresh () | ||
| 3478 | (if package-quickstart | ||
| 3479 | ;; FIXME: Delay refresh in case we're installing/deleting | ||
| 3480 | ;; several packages! | ||
| 3481 | (package-quickstart-refresh) | ||
| 3482 | (delete-file package-quickstart-file))) | ||
| 3483 | |||
| 3484 | (defun package-quickstart-refresh () | ||
| 3485 | "(Re)Generate the `package-quickstart-file'." | ||
| 3486 | (interactive) | ||
| 3487 | (package-initialize 'no-activate) | ||
| 3488 | (require 'info) | ||
| 3489 | (let ((package--quickstart-pkgs ()) | ||
| 3490 | ;; Pretend we haven't activated anything yet! | ||
| 3491 | (package-activated-list ()) | ||
| 3492 | ;; Make sure we can load this file without load-source-file-function. | ||
| 3493 | (coding-system-for-write 'emacs-internal) | ||
| 3494 | (Info-directory-list '(""))) | ||
| 3495 | (dolist (elt package-alist) | ||
| 3496 | (condition-case err | ||
| 3497 | (package-activate (car elt)) | ||
| 3498 | ;; Don't let failure of activation of a package arbitrarily stop | ||
| 3499 | ;; activation of further packages. | ||
| 3500 | (error (message "%s" (error-message-string err))))) | ||
| 3501 | (setq package--quickstart-pkgs (nreverse package--quickstart-pkgs)) | ||
| 3502 | (with-temp-file package-quickstart-file | ||
| 3503 | (emacs-lisp-mode) ;For `syntax-ppss'. | ||
| 3504 | (insert ";;; Quickstart file to activate all packages at startup -*- lexical-binding:t -*-\n") | ||
| 3505 | (insert ";; ¡¡ This file is autogenerated by `package-quickstart-refresh', DO NOT EDIT !!\n\n") | ||
| 3506 | (dolist (pkg package--quickstart-pkgs) | ||
| 3507 | (let* ((file | ||
| 3508 | ;; Prefer uncompiled files (and don't accept .so files). | ||
| 3509 | (let ((load-suffixes '(".el" ".elc"))) | ||
| 3510 | (locate-library (package--autoloads-file-name pkg)))) | ||
| 3511 | (pfile (prin1-to-string file))) | ||
| 3512 | (insert "(let ((load-file-name " pfile "))\n") | ||
| 3513 | (insert-file-contents file) | ||
| 3514 | ;; Fixup the special #$ reader form and throw away comments. | ||
| 3515 | (while (re-search-forward "#\\$\\|^;\\(.*\n\\)" nil 'move) | ||
| 3516 | (unless (nth 8 (syntax-ppss)) | ||
| 3517 | (replace-match (if (match-end 1) "" pfile) t t))) | ||
| 3518 | (unless (bolp) (insert "\n")) | ||
| 3519 | (insert ")\n"))) | ||
| 3520 | (pp `(setq package-activated-list | ||
| 3521 | (append ',(mapcar #'package-desc-name package--quickstart-pkgs) | ||
| 3522 | package-activated-list)) | ||
| 3523 | (current-buffer)) | ||
| 3524 | (let ((info-dirs (butlast Info-directory-list))) | ||
| 3525 | (when info-dirs | ||
| 3526 | (pp `(progn (require 'info) | ||
| 3527 | (info-initialize) | ||
| 3528 | (setq Info-directory-list | ||
| 3529 | (append ',info-dirs Info-directory-list))) | ||
| 3530 | (current-buffer)))) | ||
| 3531 | ;; Use `\s' instead of a space character, so this code chunk is not | ||
| 3532 | ;; mistaken for an actual file-local section of package.el. | ||
| 3533 | (insert " | ||
| 3534 | ;; Local\sVariables: | ||
| 3535 | ;; version-control: never | ||
| 3536 | ;; no-byte-compile: t | ||
| 3537 | ;; no-update-autoloads: t | ||
| 3538 | ;; End: | ||
| 3539 | ")))) | ||
| 3540 | |||
| 3418 | (provide 'package) | 3541 | (provide 'package) |
| 3419 | 3542 | ||
| 3420 | ;;; package.el ends here | 3543 | ;;; package.el ends here |
diff --git a/lisp/files.el b/lisp/files.el index bad2639fa62..1491f6049c2 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -3627,7 +3627,8 @@ local variables, but directory-local variables may still be applied." | |||
| 3627 | (push (cons (if (eq var 'eval) | 3627 | (push (cons (if (eq var 'eval) |
| 3628 | 'eval | 3628 | 'eval |
| 3629 | (indirect-variable var)) | 3629 | (indirect-variable var)) |
| 3630 | val) result)))))) | 3630 | val) |
| 3631 | result)))))) | ||
| 3631 | (forward-line 1)))))))) | 3632 | (forward-line 1)))))))) |
| 3632 | ;; Now we've read all the local variables. | 3633 | ;; Now we've read all the local variables. |
| 3633 | ;; If HANDLE-MODE is t, return whether the mode was specified. | 3634 | ;; If HANDLE-MODE is t, return whether the mode was specified. |
diff --git a/lisp/startup.el b/lisp/startup.el index 2669342edae..1faeabf23b8 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -1185,7 +1185,7 @@ please check its value") | |||
| 1185 | (package--description-file subdir) | 1185 | (package--description-file subdir) |
| 1186 | subdir)))) | 1186 | subdir)))) |
| 1187 | (throw 'package-dir-found t))))))) | 1187 | (throw 'package-dir-found t))))))) |
| 1188 | (package-initialize)) | 1188 | (package-activate-all)) |
| 1189 | 1189 | ||
| 1190 | ;; Make sure window system's init file was loaded in loadup.el if | 1190 | ;; Make sure window system's init file was loaded in loadup.el if |
| 1191 | ;; using a window system. | 1191 | ;; using a window system. |