diff options
| author | John Wiegley | 2022-11-15 09:21:07 -0800 |
|---|---|---|
| committer | John Wiegley | 2022-11-15 09:21:07 -0800 |
| commit | 49fffe7cf4beb7b35d90758f4e6c24ebfe3615e1 (patch) | |
| tree | 3b7699e4ffab2312c14f697da11059409ba4b86c | |
| parent | ec96b4766418fdfce2d7827fa6ddeb7257ad6cf7 (diff) | |
| parent | cf8ab8b52eae65a108d899e896e1171355122bb7 (diff) | |
| download | emacs-49fffe7cf4beb7b35d90758f4e6c24ebfe3615e1.tar.gz emacs-49fffe7cf4beb7b35d90758f4e6c24ebfe3615e1.zip | |
Merge remote-tracking branch 'origin/master' into pr-830
| -rw-r--r-- | doc/misc/use-package.texi | 205 | ||||
| -rw-r--r-- | etc/USE-PACKAGE-NEWS | 4 | ||||
| -rw-r--r-- | lisp/use-package/bind-chord.el | 2 | ||||
| -rw-r--r-- | lisp/use-package/bind-key.el | 24 | ||||
| -rw-r--r-- | lisp/use-package/use-package-bind-key.el | 4 | ||||
| -rw-r--r-- | lisp/use-package/use-package-chords.el | 2 | ||||
| -rw-r--r-- | lisp/use-package/use-package-core.el | 112 | ||||
| -rw-r--r-- | lisp/use-package/use-package-delight.el | 2 | ||||
| -rw-r--r-- | lisp/use-package/use-package-diminish.el | 2 | ||||
| -rw-r--r-- | lisp/use-package/use-package-ensure-system-package.el | 6 | ||||
| -rw-r--r-- | lisp/use-package/use-package-ensure.el | 8 | ||||
| -rw-r--r-- | lisp/use-package/use-package-jump.el | 15 | ||||
| -rw-r--r-- | lisp/use-package/use-package-lint.el | 4 | ||||
| -rw-r--r-- | lisp/use-package/use-package.el | 4 | ||||
| -rw-r--r-- | test/lisp/use-package/use-package-chords-tests.el | 2 | ||||
| -rw-r--r-- | test/lisp/use-package/use-package-tests.el | 25 |
16 files changed, 224 insertions, 197 deletions
diff --git a/doc/misc/use-package.texi b/doc/misc/use-package.texi index 2b868564372..a11416a470c 100644 --- a/doc/misc/use-package.texi +++ b/doc/misc/use-package.texi | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | @copying | 9 | @copying |
| 10 | @quotation | 10 | @quotation |
| 11 | Copyright (C) 2012-2022 John Wiegley <johnw@@newartisans.com> | 11 | Copyright (C) 2012-2022 Free Software Foundation, Inc. |
| 12 | 12 | ||
| 13 | You can redistribute this document and/or modify it under the terms | 13 | You can redistribute this document and/or modify it under the terms |
| 14 | of the GNU General Public License as published by the Free Software | 14 | of the GNU General Public License as published by the Free Software |
| @@ -31,7 +31,7 @@ General Public License for more details. | |||
| 31 | @finalout | 31 | @finalout |
| 32 | @titlepage | 32 | @titlepage |
| 33 | @title use-package User Manual | 33 | @title use-package User Manual |
| 34 | @subtitle for version 2.4.1-81-gb185c6b+1 | 34 | @subtitle for version 2.4.1-119-g0be480e+1 |
| 35 | @author John Wiegley | 35 | @author John Wiegley |
| 36 | @page | 36 | @page |
| 37 | @vskip 0pt plus 1filll | 37 | @vskip 0pt plus 1filll |
| @@ -45,9 +45,9 @@ General Public License for more details. | |||
| 45 | @top use-package User Manual | 45 | @top use-package User Manual |
| 46 | 46 | ||
| 47 | The @code{use-package} macro allows you to isolate package configuration in your | 47 | The @code{use-package} macro allows you to isolate package configuration in your |
| 48 | @code{.emacs} file in a way that is both performance-oriented and, well, tidy. I | 48 | @code{.emacs} file in a way that is both performance-oriented and, well, tidy. I |
| 49 | created it because I have over 80 packages that I use in Emacs, and things | 49 | created it because I have over 80 packages that I use in Emacs, and things |
| 50 | were getting difficult to manage. Yet with this utility my total load time is | 50 | were getting difficult to manage. Yet with this utility my total load time is |
| 51 | around 2 seconds, with no loss of functionality! | 51 | around 2 seconds, with no loss of functionality! |
| 52 | 52 | ||
| 53 | @insertcopying | 53 | @insertcopying |
| @@ -67,33 +67,33 @@ around 2 seconds, with no loss of functionality! | |||
| 67 | 67 | ||
| 68 | Installation | 68 | Installation |
| 69 | 69 | ||
| 70 | * Installing from an Elpa Archive:: | 70 | * Installing from GNU ELPA:: |
| 71 | * Installing from the Git Repository:: | 71 | * Installing from the Git Repository:: |
| 72 | * Post-Installation Tasks:: | 72 | * Post-Installation Tasks:: |
| 73 | 73 | ||
| 74 | Keywords | 74 | Keywords |
| 75 | 75 | ||
| 76 | * @code{after}:: | 76 | * @code{after}:: @code{:after}. |
| 77 | * @code{bind-keymap}, @code{bind-keymap*}: @code{bind-keymap} @code{bind-keymap*}. | 77 | * @code{bind-keymap} @code{bind-keymap*}:: @code{:bind-keymap}, @code{:bind-keymap*}. |
| 78 | * @code{bind}, @code{bind*}: @code{bind} @code{bind*}. | 78 | * @code{bind} @code{bind*}:: @code{:bind}, @code{:bind*}. |
| 79 | * @code{commands}:: | 79 | * @code{commands}:: @code{:commands}. |
| 80 | * @code{preface}, @code{init}, @code{config}: @code{preface} @code{init} @code{config}. | 80 | * @code{preface} @code{init} @code{config}:: @code{:preface}, @code{:init}, @code{:config}. |
| 81 | * @code{custom}:: | 81 | * @code{custom}:: @code{:custom}. |
| 82 | * @code{custom-face}:: | 82 | * @code{custom-face}:: @code{:custom-face}. |
| 83 | * @code{defer}, @code{demand}: @code{defer} @code{demand}. | 83 | * @code{defer} @code{demand}:: @code{:defer}, @code{:demand}. |
| 84 | * @code{defines}, @code{functions}: @code{defines} @code{functions}. | 84 | * @code{defines} @code{functions}:: @code{:defines}, @code{:functions}. |
| 85 | * @code{diminish}, @code{delight}: @code{diminish} @code{delight}. | 85 | * @code{diminish} @code{delight}:: @code{:diminish}, @code{:delight}. |
| 86 | * @code{disabled}:: | 86 | * @code{disabled}:: @code{:disabled}. |
| 87 | * @code{ensure}, @code{pin}: @code{ensure} @code{pin}. | 87 | * @code{ensure} @code{pin}:: @code{:ensure}, @code{:pin}. |
| 88 | * @code{hook}:: | 88 | * @code{hook}:: @code{:hook}. |
| 89 | * @code{if}, @code{when}, @code{unless}: @code{if} @code{when} @code{unless}. | 89 | * @code{if} @code{when} @code{unless}:: @code{:if}, @code{:when}, @code{:unless}. |
| 90 | * @code{load-path}:: | 90 | * @code{load-path}:: @code{:load-path}. |
| 91 | * @code{mode}, @code{interpreter}: @code{mode} @code{interpreter}. | 91 | * @code{mode} @code{interpreter}:: @code{:mode}, @code{:interpreter}. |
| 92 | * @code{magic}, @code{magic-fallback}: @code{magic} @code{magic-fallback}. | 92 | * @code{magic} @code{magic-fallback}:: @code{:magic}, @code{:magic-fallback}. |
| 93 | * @code{no-require}:: | 93 | * @code{no-require}:: @code{:no-require}. |
| 94 | * @code{requires}:: | 94 | * @code{requires}:: @code{:requires}. |
| 95 | 95 | ||
| 96 | @code{:bind}, @code{:bind*} | 96 | @code{bind}, @code{bind*} |
| 97 | 97 | ||
| 98 | * Binding to local keymaps:: | 98 | * Binding to local keymaps:: |
| 99 | 99 | ||
| @@ -105,9 +105,9 @@ Keywords | |||
| 105 | @chapter Introduction | 105 | @chapter Introduction |
| 106 | 106 | ||
| 107 | The @code{use-package} macro allows you to isolate package configuration in your | 107 | The @code{use-package} macro allows you to isolate package configuration in your |
| 108 | @code{.emacs} file in a way that is both performance-oriented and, well, tidy. I | 108 | @code{.emacs} file in a way that is both performance-oriented and, well, tidy. I |
| 109 | created it because I have over 80 packages that I use in Emacs, and things | 109 | created it because I have over 80 packages that I use in Emacs, and things |
| 110 | were getting difficult to manage. Yet with this utility my total load time is | 110 | were getting difficult to manage. Yet with this utility my total load time is |
| 111 | around 2 seconds, with no loss of functionality! | 111 | around 2 seconds, with no loss of functionality! |
| 112 | 112 | ||
| 113 | More text to come@dots{} | 113 | More text to come@dots{} |
| @@ -119,50 +119,27 @@ use-package can be installed using Emacs' package manager or manually from | |||
| 119 | its development repository. | 119 | its development repository. |
| 120 | 120 | ||
| 121 | @menu | 121 | @menu |
| 122 | * Installing from an Elpa Archive:: | 122 | * Installing from GNU ELPA:: |
| 123 | * Installing from the Git Repository:: | 123 | * Installing from the Git Repository:: |
| 124 | * Post-Installation Tasks:: | 124 | * Post-Installation Tasks:: |
| 125 | @end menu | 125 | @end menu |
| 126 | 126 | ||
| 127 | @node Installing from an Elpa Archive | 127 | @node Installing from GNU ELPA |
| 128 | @section Installing from an Elpa Archive | 128 | @section Installing from GNU ELPA |
| 129 | 129 | ||
| 130 | use-package is available from Melpa and Melpa-Stable. If you haven't used | 130 | use-package is available from GNU ELPA. If you haven't used |
| 131 | Emacs' package manager before, then it is high time you familiarize yourself | 131 | Emacs' package manager before, then it is high time you familiarize yourself |
| 132 | with it by reading the documentation in the Emacs manual, see | 132 | with it by reading the documentation in the Emacs manual, see |
| 133 | @ref{Packages,,,emacs,}. Then add one of the archives to @code{package-archives}: | 133 | @ref{Packages,,,emacs,}. Then add one of the archives to @code{package-archives}: |
| 134 | 134 | ||
| 135 | @itemize | 135 | First, you need to update the local package list using: |
| 136 | @item | ||
| 137 | To use Melpa: | ||
| 138 | @end itemize | ||
| 139 | |||
| 140 | @lisp | ||
| 141 | (require 'package) | ||
| 142 | (add-to-list 'package-archives | ||
| 143 | '("melpa" . "https://melpa.org/packages/") t) | ||
| 144 | @end lisp | ||
| 145 | |||
| 146 | @itemize | ||
| 147 | @item | ||
| 148 | To use Melpa-Stable: | ||
| 149 | @end itemize | ||
| 150 | |||
| 151 | @lisp | ||
| 152 | (require 'package) | ||
| 153 | (add-to-list 'package-archives | ||
| 154 | '("melpa-stable" . "https://stable.melpa.org/packages/") t) | ||
| 155 | @end lisp | ||
| 156 | |||
| 157 | Once you have added your preferred archive, you need to update the | ||
| 158 | local package list using: | ||
| 159 | 136 | ||
| 160 | @example | 137 | @example |
| 161 | M-x package-refresh-contents RET | 138 | M-x package-refresh-contents RET |
| 162 | @end example | 139 | @end example |
| 163 | 140 | ||
| 164 | Once you have done that, you can install use-package and its dependencies | 141 | Once you have done that, you can install use-package and its |
| 165 | using: | 142 | dependencies using: |
| 166 | 143 | ||
| 167 | @example | 144 | @example |
| 168 | M-x package-install RET use-package RET | 145 | M-x package-install RET use-package RET |
| @@ -229,7 +206,7 @@ Now see @ref{Post-Installation Tasks}. | |||
| 229 | @section Post-Installation Tasks | 206 | @section Post-Installation Tasks |
| 230 | 207 | ||
| 231 | After installing use-package you should verify that you are indeed using the | 208 | After installing use-package you should verify that you are indeed using the |
| 232 | use-package release you think you are using. It's best to restart Emacs before | 209 | use-package release you think you are using. It's best to restart Emacs before |
| 233 | doing so, to make sure you are not using an outdated value for @code{load-path}. | 210 | doing so, to make sure you are not using an outdated value for @code{load-path}. |
| 234 | 211 | ||
| 235 | @example | 212 | @example |
| @@ -239,7 +216,7 @@ C-h v use-package-version RET | |||
| 239 | should display something like | 216 | should display something like |
| 240 | 217 | ||
| 241 | @example | 218 | @example |
| 242 | use-package-version’s value is "2.4.1" | 219 | use-package-version’s value is "2.4.3" |
| 243 | @end example | 220 | @end example |
| 244 | 221 | ||
| 245 | If you are completely new to use-package then see @ref{Getting Started}. | 222 | If you are completely new to use-package then see @ref{Getting Started}. |
| @@ -249,13 +226,13 @@ If you run into problems, then please see the @ref{Debugging Tools}. | |||
| 249 | @node Getting Started | 226 | @node Getting Started |
| 250 | @chapter Getting Started | 227 | @chapter Getting Started |
| 251 | 228 | ||
| 252 | TODO@. For now, see @code{README.md}. | 229 | TODO@. For now, see @code{README.md}. |
| 253 | 230 | ||
| 254 | @node Basic Concepts | 231 | @node Basic Concepts |
| 255 | @chapter Basic Concepts | 232 | @chapter Basic Concepts |
| 256 | 233 | ||
| 257 | @code{use-package} was created for few basic reasons, each of which drove the | 234 | @code{use-package} was created for few basic reasons, each of which drove the |
| 258 | design in various ways. Understanding these reasons may help make some of | 235 | design in various ways. Understanding these reasons may help make some of |
| 259 | those decisions clearer: | 236 | those decisions clearer: |
| 260 | 237 | ||
| 261 | @itemize | 238 | @itemize |
| @@ -279,7 +256,7 @@ close to a functional Emacs as possible. | |||
| 279 | 256 | ||
| 280 | @item | 257 | @item |
| 281 | To allow byte-compilation of one's init file so that any warnings or | 258 | To allow byte-compilation of one's init file so that any warnings or |
| 282 | errors seen are meaningful. In this way, even if byte-compilation is not | 259 | errors seen are meaningful. In this way, even if byte-compilation is not |
| 283 | used for speed (reason 3), it can still be used as a sanity check. | 260 | used for speed (reason 3), it can still be used as a sanity check. |
| 284 | @end itemize | 261 | @end itemize |
| 285 | 262 | ||
| @@ -290,25 +267,25 @@ used for speed (reason 3), it can still be used as a sanity check. | |||
| 290 | @chapter Keywords | 267 | @chapter Keywords |
| 291 | 268 | ||
| 292 | @menu | 269 | @menu |
| 293 | * @code{after}:: | 270 | * @code{after}:: @code{after}. |
| 294 | * @code{bind-keymap}, @code{bind-keymap*}: @code{bind-keymap} @code{bind-keymap*}. | 271 | * @code{bind-keymap} @code{bind-keymap*}:: @code{:bind-keymap}, @code{:bind-keymap*}. |
| 295 | * @code{bind}, @code{bind*}: @code{bind} @code{bind*}. | 272 | * @code{bind} @code{bind*}:: @code{bind} @code{:bind*}. |
| 296 | * @code{commands}:: | 273 | * @code{commands}:: @code{:commands}. |
| 297 | * @code{preface}, @code{init}, @code{config}: @code{preface} @code{init} @code{config}. | 274 | * @code{preface} @code{init} @code{config}:: @code{:preface}, @code{:init}, @code{:config}. |
| 298 | * @code{custom}:: | 275 | * @code{custom}:: @code{:custom}. |
| 299 | * @code{custom-face}:: | 276 | * @code{custom-face}:: @code{:custom-face}. |
| 300 | * @code{defer}, @code{demand}: @code{defer} @code{demand}. | 277 | * @code{defer} @code{demand}:: @code{:defer}, @code{:demand}. |
| 301 | * @code{defines}, @code{functions}: @code{defines} @code{functions}. | 278 | * @code{defines} @code{functions}:: @code{:defines}, @code{:functions}. |
| 302 | * @code{diminish}, @code{delight}: @code{diminish} @code{delight}. | 279 | * @code{diminish} @code{delight}:: @code{:diminish}, @code{:delight}. |
| 303 | * @code{disabled}:: | 280 | * @code{disabled}:: @code{:disabled}. |
| 304 | * @code{ensure}, @code{pin}: @code{ensure} @code{pin}. | 281 | * @code{ensure} @code{pin}:: @code{:ensure}, @code{:pin}. |
| 305 | * @code{hook}:: | 282 | * @code{hook}:: @code{:hook}. |
| 306 | * @code{if}, @code{when}, @code{unless}: @code{if} @code{when} @code{unless}. | 283 | * @code{if} @code{when} @code{unless}:: @code{:if}, @code{:when}, @code{:unless}. |
| 307 | * @code{load-path}:: | 284 | * @code{load-path}:: @code{:load-path}. |
| 308 | * @code{mode}, @code{interpreter}: @code{mode} @code{interpreter}. | 285 | * @code{mode} @code{interpreter}:: @code{:mode}, @code{:interpreter}. |
| 309 | * @code{magic}, @code{magic-fallback}: @code{magic} @code{magic-fallback}. | 286 | * @code{magic} @code{magic-fallback}:: @code{:magic}, @code{:magic-fallback}. |
| 310 | * @code{no-require}:: | 287 | * @code{no-require}:: @code{:no-require}. |
| 311 | * @code{requires}:: | 288 | * @code{requires}:: @code{:requires}. |
| 312 | @end menu | 289 | @end menu |
| 313 | 290 | ||
| 314 | @node @code{after} | 291 | @node @code{after} |
| @@ -316,8 +293,8 @@ used for speed (reason 3), it can still be used as a sanity check. | |||
| 316 | 293 | ||
| 317 | Sometimes it only makes sense to configure a package after another has been | 294 | Sometimes it only makes sense to configure a package after another has been |
| 318 | loaded, because certain variables or functions are not in scope until that | 295 | loaded, because certain variables or functions are not in scope until that |
| 319 | time. This can achieved using an @code{:after} keyword that allows a fairly rich | 296 | time. This can achieved using an @code{:after} keyword that allows a fairly rich |
| 320 | description of the exact conditions when loading should occur. Here is an | 297 | description of the exact conditions when loading should occur. Here is an |
| 321 | example: | 298 | example: |
| 322 | 299 | ||
| 323 | @lisp | 300 | @lisp |
| @@ -332,13 +309,13 @@ example: | |||
| 332 | @end lisp | 309 | @end lisp |
| 333 | 310 | ||
| 334 | In this case, because all of these packages are demand-loaded in the order | 311 | In this case, because all of these packages are demand-loaded in the order |
| 335 | they occur, the use of @code{:after} is not strictly necessary. By using it, | 312 | they occur, the use of @code{:after} is not strictly necessary. By using it, |
| 336 | however, the above code becomes order-independent, without an implicit | 313 | however, the above code becomes order-independent, without an implicit |
| 337 | depedence on the nature of your init file. | 314 | depedence on the nature of your init file. |
| 338 | 315 | ||
| 339 | By default, @code{:after (foo bar)} is the same as @code{:after (:all foo bar)}, meaning | 316 | By default, @code{:after (foo bar)} is the same as @code{:after (:all foo bar)}, meaning |
| 340 | that loading of the given package will not happen until both @code{foo} and @code{bar} | 317 | that loading of the given package will not happen until both @code{foo} and @code{bar} |
| 341 | have been loaded. Here are some of the other possibilities: | 318 | have been loaded. Here are some of the other possibilities: |
| 342 | 319 | ||
| 343 | @lisp | 320 | @lisp |
| 344 | :after (foo bar) | 321 | :after (foo bar) |
| @@ -354,7 +331,7 @@ been loaded, or both @code{baz} and @code{quux} have been loaded. | |||
| 354 | 331 | ||
| 355 | @strong{NOTE}: Pay attention if you set @code{use-package-always-defer} to t, and also use | 332 | @strong{NOTE}: Pay attention if you set @code{use-package-always-defer} to t, and also use |
| 356 | the @code{:after} keyword, as you will need to specify how the declared package is | 333 | the @code{:after} keyword, as you will need to specify how the declared package is |
| 357 | to be loaded: e.g., by some @code{:bind}. If you're not using one of the mechanisms | 334 | to be loaded: e.g., by some @code{:bind}. If you're not using one of the mechanisms |
| 358 | that registers autoloads, such as @code{:bind} or @code{:hook}, and your package manager | 335 | that registers autoloads, such as @code{:bind} or @code{:hook}, and your package manager |
| 359 | does not provide autoloads, it's possible that without adding @code{:demand t} to | 336 | does not provide autoloads, it's possible that without adding @code{:demand t} to |
| 360 | those declarations, your package will never be loaded. | 337 | those declarations, your package will never be loaded. |
| @@ -363,14 +340,14 @@ those declarations, your package will never be loaded. | |||
| 363 | @section @code{:bind-keymap}, @code{:bind-keymap*} | 340 | @section @code{:bind-keymap}, @code{:bind-keymap*} |
| 364 | 341 | ||
| 365 | Normally @code{:bind} expects that commands are functions that will be autoloaded | 342 | Normally @code{:bind} expects that commands are functions that will be autoloaded |
| 366 | from the given package. However, this does not work if one of those commands | 343 | from the given package. However, this does not work if one of those commands |
| 367 | is actually a keymap, since keymaps are not functions, and cannot be | 344 | is actually a keymap, since keymaps are not functions, and cannot be |
| 368 | autoloaded using Emacs' @code{autoload} mechanism. | 345 | autoloaded using Emacs' @code{autoload} mechanism. |
| 369 | 346 | ||
| 370 | To handle this case, @code{use-package} offers a special, limited variant of | 347 | To handle this case, @code{use-package} offers a special, limited variant of |
| 371 | @code{:bind} called @code{:bind-keymap}. The only difference is that the "commands" | 348 | @code{:bind} called @code{:bind-keymap}. The only difference is that the "commands" |
| 372 | bound to by @code{:bind-keymap} must be keymaps defined in the package, rather than | 349 | bound to by @code{:bind-keymap} must be keymaps defined in the package, rather than |
| 373 | command functions. This is handled behind the scenes by generating custom code | 350 | command functions. This is handled behind the scenes by generating custom code |
| 374 | that loads the package containing the keymap, and then re-executes your | 351 | that loads the package containing the keymap, and then re-executes your |
| 375 | keypress after the first load, to reinterpret that keypress as a prefix key. | 352 | keypress after the first load, to reinterpret that keypress as a prefix key. |
| 376 | 353 | ||
| @@ -409,7 +386,7 @@ A more literal way to do the exact same thing is: | |||
| 409 | @end lisp | 386 | @end lisp |
| 410 | 387 | ||
| 411 | When you use the @code{:commands} keyword, it creates autoloads for those commands | 388 | When you use the @code{:commands} keyword, it creates autoloads for those commands |
| 412 | and defers loading of the module until they are used. Since the @code{:init} form | 389 | and defers loading of the module until they are used. Since the @code{:init} form |
| 413 | is always run---even if @code{ace-jump-mode} might not be on your system---remember | 390 | is always run---even if @code{ace-jump-mode} might not be on your system---remember |
| 414 | to restrict @code{:init} code to only what would succeed either way. | 391 | to restrict @code{:init} code to only what would succeed either way. |
| 415 | 392 | ||
| @@ -425,7 +402,7 @@ The @code{:bind} keyword takes either a cons or a list of conses: | |||
| 425 | The @code{:commands} keyword likewise takes either a symbol or a list of symbols. | 402 | The @code{:commands} keyword likewise takes either a symbol or a list of symbols. |
| 426 | 403 | ||
| 427 | NOTE: Special keys like @code{tab} or @code{F1}-@code{Fn} can be written in square brackets, | 404 | NOTE: Special keys like @code{tab} or @code{F1}-@code{Fn} can be written in square brackets, |
| 428 | i.e. @code{[tab]} instead of @code{"tab"}. The syntax for the keybindings is similar to | 405 | i.e. @code{[tab]} instead of @code{"tab"}. The syntax for the keybindings is similar to |
| 429 | the "kbd" syntax: see @uref{https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Rebinding.html, the Emacs Manual} for more information. | 406 | the "kbd" syntax: see @uref{https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Rebinding.html, the Emacs Manual} for more information. |
| 430 | 407 | ||
| 431 | Examples: | 408 | Examples: |
| @@ -459,7 +436,7 @@ The effect of this statement is to wait until @code{helm} has loaded, and then t | |||
| 459 | bind the key @code{C-c h} to @code{helm-execute-persistent-action} within Helm's local | 436 | bind the key @code{C-c h} to @code{helm-execute-persistent-action} within Helm's local |
| 460 | keymap, @code{helm-mode-map}. | 437 | keymap, @code{helm-mode-map}. |
| 461 | 438 | ||
| 462 | Multiple uses of @code{:map} may be specified. Any binding occurring before the | 439 | Multiple uses of @code{:map} may be specified. Any binding occurring before the |
| 463 | first use of @code{:map} are applied to the global keymap: | 440 | first use of @code{:map} are applied to the global keymap: |
| 464 | 441 | ||
| 465 | @lisp | 442 | @lisp |
| @@ -493,7 +470,7 @@ Here is the simplest @code{use-package} declaration: | |||
| 493 | @end lisp | 470 | @end lisp |
| 494 | 471 | ||
| 495 | This loads in the package @code{foo}, but only if @code{foo} is available on your | 472 | This loads in the package @code{foo}, but only if @code{foo} is available on your |
| 496 | system. If not, a warning is logged to the @code{*Messages*} buffer. If it | 473 | system. If not, a warning is logged to the @code{*Messages*} buffer. If it |
| 497 | succeeds, a message about @code{"Loading foo"} is logged, along with the time it | 474 | succeeds, a message about @code{"Loading foo"} is logged, along with the time it |
| 498 | took to load, if it took over 0.1 seconds. | 475 | took to load, if it took over 0.1 seconds. |
| 499 | 476 | ||
| @@ -567,14 +544,14 @@ The @code{:custom-face} keyword allows customization of package custom faces. | |||
| 567 | @node @code{defer} @code{demand} | 544 | @node @code{defer} @code{demand} |
| 568 | @section @code{:defer}, @code{:demand} | 545 | @section @code{:defer}, @code{:demand} |
| 569 | 546 | ||
| 570 | In almost all cases you don't need to manually specify @code{:defer t}. This is | 547 | In almost all cases you don't need to manually specify @code{:defer t}. This is |
| 571 | implied whenever @code{:bind} or @code{:mode} or @code{:interpreter} is used. Typically, you | 548 | implied whenever @code{:bind} or @code{:mode} or @code{:interpreter} is used. Typically, you |
| 572 | only need to specify @code{:defer} if you know for a fact that some other package | 549 | only need to specify @code{:defer} if you know for a fact that some other package |
| 573 | will do something to cause your package to load at the appropriate time, and | 550 | will do something to cause your package to load at the appropriate time, and |
| 574 | thus you would like to defer loading even though use-package isn't creating | 551 | thus you would like to defer loading even though use-package isn't creating |
| 575 | any autoloads for you. | 552 | any autoloads for you. |
| 576 | 553 | ||
| 577 | You can override package deferral with the @code{:demand} keyword. Thus, even if | 554 | You can override package deferral with the @code{:demand} keyword. Thus, even if |
| 578 | you use @code{:bind}, using @code{:demand} will force loading to occur immediately and | 555 | you use @code{:bind}, using @code{:demand} will force loading to occur immediately and |
| 579 | not establish an autoload for the bound key. | 556 | not establish an autoload for the bound key. |
| 580 | 557 | ||
| @@ -616,7 +593,7 @@ If you need to silence a missing function warning, you can use @code{:functions} | |||
| 616 | @section @code{:diminish}, @code{:delight} | 593 | @section @code{:diminish}, @code{:delight} |
| 617 | 594 | ||
| 618 | @code{use-package} also provides built-in support for the diminish and delight | 595 | @code{use-package} also provides built-in support for the diminish and delight |
| 619 | utilities---if you have them installed. Their purpose is to remove or change | 596 | utilities---if you have them installed. Their purpose is to remove or change |
| 620 | minor mode strings in your mode-line. | 597 | minor mode strings in your mode-line. |
| 621 | 598 | ||
| 622 | @uref{https://github.com/myrjola/diminish.el, diminish} is invoked with the @code{:diminish} keyword, which is passed either a | 599 | @uref{https://github.com/myrjola/diminish.el, diminish} is invoked with the @code{:diminish} keyword, which is passed either a |
| @@ -635,7 +612,7 @@ package name with "-mode" appended at the end: | |||
| 635 | @uref{https://elpa.gnu.org/packages/delight.html, delight} is invoked with the @code{:delight} keyword, which is passed a minor mode | 612 | @uref{https://elpa.gnu.org/packages/delight.html, delight} is invoked with the @code{:delight} keyword, which is passed a minor mode |
| 636 | symbol, a replacement string or quoted @uref{https://www.gnu.org/software/emacs/manual/html_node/elisp/Mode-Line-Data.html, mode-line data} (in which case the minor | 613 | symbol, a replacement string or quoted @uref{https://www.gnu.org/software/emacs/manual/html_node/elisp/Mode-Line-Data.html, mode-line data} (in which case the minor |
| 637 | mode symbol is guessed to be the package name with "-mode" appended at the | 614 | mode symbol is guessed to be the package name with "-mode" appended at the |
| 638 | end), both of these, or several lists of both. If no arguments are provided, | 615 | end), both of these, or several lists of both. If no arguments are provided, |
| 639 | the default mode name is hidden completely. | 616 | the default mode name is hidden completely. |
| 640 | 617 | ||
| 641 | @lisp | 618 | @lisp |
| @@ -677,7 +654,7 @@ from the output entirely, to accelerate startup times. | |||
| 677 | @node @code{ensure} @code{pin} | 654 | @node @code{ensure} @code{pin} |
| 678 | @section @code{:ensure}, @code{:pin} | 655 | @section @code{:ensure}, @code{:pin} |
| 679 | 656 | ||
| 680 | You can use @code{use-package} to load packages from ELPA with @code{package.el}. This | 657 | You can use @code{use-package} to load packages from ELPA with @code{package.el}. This |
| 681 | is particularly useful if you share your @code{.emacs} among several machines; the | 658 | is particularly useful if you share your @code{.emacs} among several machines; the |
| 682 | relevant packages are downloaded automatically once declared in your @code{.emacs}. | 659 | relevant packages are downloaded automatically once declared in your @code{.emacs}. |
| 683 | The @code{:ensure} keyword causes the package(s) to be installed automatically if | 660 | The @code{:ensure} keyword causes the package(s) to be installed automatically if |
| @@ -707,7 +684,7 @@ archives is also a valid use-case. | |||
| 707 | By default @code{package.el} prefers @code{melpa} over @code{melpa-stable} due to the | 684 | By default @code{package.el} prefers @code{melpa} over @code{melpa-stable} due to the |
| 708 | versioning @code{(> evil-20141208.623 evil-1.0.9)}, so even if you are tracking | 685 | versioning @code{(> evil-20141208.623 evil-1.0.9)}, so even if you are tracking |
| 709 | only a single package from @code{melpa}, you will need to tag all the non-@code{melpa} | 686 | only a single package from @code{melpa}, you will need to tag all the non-@code{melpa} |
| 710 | packages with the appropriate archive. If this really annoys you, then you can | 687 | packages with the appropriate archive. If this really annoys you, then you can |
| 711 | set @code{use-package-always-pin} to set a default. | 688 | set @code{use-package-always-pin} to set a default. |
| 712 | 689 | ||
| 713 | If you want to manually keep a package updated and ignore upstream updates, | 690 | If you want to manually keep a package updated and ignore upstream updates, |
| @@ -752,7 +729,7 @@ Example: | |||
| 752 | @section @code{:hook} | 729 | @section @code{:hook} |
| 753 | 730 | ||
| 754 | The @code{:hook} keyword allows adding functions onto hooks, here only the basename | 731 | The @code{:hook} keyword allows adding functions onto hooks, here only the basename |
| 755 | of the hook is required. Thus, all of the following are equivalent: | 732 | of the hook is required. Thus, all of the following are equivalent: |
| 756 | 733 | ||
| 757 | @lisp | 734 | @lisp |
| 758 | (use-package ace-jump-mode | 735 | (use-package ace-jump-mode |
| @@ -827,8 +804,8 @@ the same thing as @code{:if (not foo)}. | |||
| 827 | @section @code{:load-path} | 804 | @section @code{:load-path} |
| 828 | 805 | ||
| 829 | If your package needs a directory added to the @code{load-path} in order to load, | 806 | If your package needs a directory added to the @code{load-path} in order to load, |
| 830 | use @code{:load-path}. This takes a symbol, a function, a string or a list of | 807 | use @code{:load-path}. This takes a symbol, a function, a string or a list of |
| 831 | strings. If the path is relative, it is expanded within | 808 | strings. If the path is relative, it is expanded within |
| 832 | @code{user-emacs-directory}: | 809 | @code{user-emacs-directory}: |
| 833 | 810 | ||
| 834 | @lisp | 811 | @lisp |
| @@ -839,8 +816,8 @@ strings. If the path is relative, it is expanded within | |||
| 839 | 816 | ||
| 840 | Note that when using a symbol or a function to provide a dynamically generated | 817 | Note that when using a symbol or a function to provide a dynamically generated |
| 841 | list of paths, you must inform the byte-compiler of this definition so the | 818 | list of paths, you must inform the byte-compiler of this definition so the |
| 842 | value is available at byte-compilation time. This is done by using the special | 819 | value is available at byte-compilation time. This is done by using the special |
| 843 | form @code{eval-and-compile} (as opposed to @code{eval-when-compile}). Further, this | 820 | form @code{eval-and-compile} (as opposed to @code{eval-when-compile}). Further, this |
| 844 | value is fixed at whatever was determined during compilation, to avoid looking | 821 | value is fixed at whatever was determined during compilation, to avoid looking |
| 845 | up the same information again on each startup: | 822 | up the same information again on each startup: |
| 846 | 823 | ||
| @@ -859,7 +836,7 @@ up the same information again on each startup: | |||
| 859 | 836 | ||
| 860 | Similar to @code{:bind}, you can use @code{:mode} and @code{:interpreter} to establish a | 837 | Similar to @code{:bind}, you can use @code{:mode} and @code{:interpreter} to establish a |
| 861 | deferred binding within the @code{auto-mode-alist} and @code{interpreter-mode-alist} | 838 | deferred binding within the @code{auto-mode-alist} and @code{interpreter-mode-alist} |
| 862 | variables. The specifier to either keyword can be a cons cell, a list of cons | 839 | variables. The specifier to either keyword can be a cons cell, a list of cons |
| 863 | cells, or a string or regexp: | 840 | cells, or a string or regexp: |
| 864 | 841 | ||
| 865 | @lisp | 842 | @lisp |
| @@ -898,8 +875,8 @@ This does exactly the same thing as the following: | |||
| 898 | 875 | ||
| 899 | Similar to @code{:mode} and @code{:interpreter}, you can also use @code{:magic} and | 876 | Similar to @code{:mode} and @code{:interpreter}, you can also use @code{:magic} and |
| 900 | @code{:magic-fallback} to cause certain function to be run if the beginning of a | 877 | @code{:magic-fallback} to cause certain function to be run if the beginning of a |
| 901 | file matches a given regular expression. The difference between the two is | 878 | file matches a given regular expression. The difference between the two is |
| 902 | that @code{:magic-fallback} has a lower priority than @code{:mode}. For example: | 879 | that @code{:magic-fallback} has a lower priority than @code{:mode}. For example: |
| 903 | 880 | ||
| 904 | @lisp | 881 | @lisp |
| 905 | (use-package pdf-tools | 882 | (use-package pdf-tools |
| @@ -918,9 +895,9 @@ string @code{"%PDF"}. | |||
| 918 | 895 | ||
| 919 | Normally, @code{use-package} will load each package at compile time before | 896 | Normally, @code{use-package} will load each package at compile time before |
| 920 | compiling the configuration, to ensure that any necessary symbols are in scope | 897 | compiling the configuration, to ensure that any necessary symbols are in scope |
| 921 | to satisfy the byte-compiler. At times this can cause problems, since a | 898 | to satisfy the byte-compiler. At times this can cause problems, since a |
| 922 | package may have special loading requirements, and all that you want to use | 899 | package may have special loading requirements, and all that you want to use |
| 923 | @code{use-package} for is to add a configuration to the @code{eval-after-load} hook. In | 900 | @code{use-package} for is to add a configuration to the @code{eval-after-load} hook. In |
| 924 | such cases, use the @code{:no-require} keyword: | 901 | such cases, use the @code{:no-require} keyword: |
| 925 | 902 | ||
| 926 | @lisp | 903 | @lisp |
| @@ -936,8 +913,8 @@ such cases, use the @code{:no-require} keyword: | |||
| 936 | While the @code{:after} keyword delays loading until the dependencies are loaded, | 913 | While the @code{:after} keyword delays loading until the dependencies are loaded, |
| 937 | the somewhat simpler @code{:requires} keyword simply never loads the package if the | 914 | the somewhat simpler @code{:requires} keyword simply never loads the package if the |
| 938 | dependencies are not available at the time the @code{use-package} declaration is | 915 | dependencies are not available at the time the @code{use-package} declaration is |
| 939 | encountered. By "available" in this context it means that @code{foo} is available | 916 | encountered. By "available" in this context it means that @code{foo} is available |
| 940 | of @code{(featurep 'foo)} evaluates to a non-nil value. For example: | 917 | of @code{(featurep 'foo)} evaluates to a non-nil value. For example: |
| 941 | 918 | ||
| 942 | @lisp | 919 | @lisp |
| 943 | (use-package abbrev | 920 | (use-package abbrev |
diff --git a/etc/USE-PACKAGE-NEWS b/etc/USE-PACKAGE-NEWS index 1f516966980..c499820755f 100644 --- a/etc/USE-PACKAGE-NEWS +++ b/etc/USE-PACKAGE-NEWS | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | # Changes | 1 | # Changes |
| 2 | 2 | ||
| 3 | ## 2.4.4 | ||
| 4 | |||
| 5 | This release prepares for inclusion to GNU ELPA and includes no other changes | ||
| 6 | |||
| 3 | ## 2.4.1 | 7 | ## 2.4.1 |
| 4 | 8 | ||
| 5 | This is mostly a bug-fix release: | 9 | This is mostly a bug-fix release: |
diff --git a/lisp/use-package/bind-chord.el b/lisp/use-package/bind-chord.el index d69a724df66..d592736e227 100644 --- a/lisp/use-package/bind-chord.el +++ b/lisp/use-package/bind-chord.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; bind-chord.el --- key-chord binding helper for use-package-chords -*- lexical-binding: t; -*- | 1 | ;;; bind-chord.el --- key-chord binding helper for use-package-chords -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2015-2019 Justin Talbott | 3 | ;; Copyright (C) 2015-2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Justin Talbott <justin@waymondo.com> | 5 | ;; Author: Justin Talbott <justin@waymondo.com> |
| 6 | ;; Keywords: convenience, tools, extensions | 6 | ;; Keywords: convenience, tools, extensions |
diff --git a/lisp/use-package/bind-key.el b/lisp/use-package/bind-key.el index 5060e16ddf9..b02b7a4ad9f 100644 --- a/lisp/use-package/bind-key.el +++ b/lisp/use-package/bind-key.el | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | ;;; bind-key.el --- A simple way to manage personal keybindings -*- lexical-binding: t; -*- | 1 | ;;; bind-key.el --- A simple way to manage personal keybindings -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (c) 2012-2017 John Wiegley | 3 | ;; Copyright (c) 2012-2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@newartisans.com> | 5 | ;; Author: John Wiegley <johnw@newartisans.com> |
| 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> | 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> |
| 7 | ;; Created: 16 Jun 2012 | 7 | ;; Created: 16 Jun 2012 |
| 8 | ;; Modified: 29 Nov 2017 | 8 | ;; Modified: 29 Nov 2017 |
| 9 | ;; Version: 2.4 | 9 | ;; Version: 2.4.1 |
| 10 | ;; Keywords: keys keybinding config dotemacs | 10 | ;; Keywords: keys keybinding config dotemacs |
| 11 | ;; URL: https://github.com/jwiegley/use-package | 11 | ;; URL: https://github.com/jwiegley/use-package |
| 12 | 12 | ||
| @@ -29,7 +29,7 @@ | |||
| 29 | 29 | ||
| 30 | ;; If you have lots of keybindings set in your .emacs file, it can be hard to | 30 | ;; If you have lots of keybindings set in your .emacs file, it can be hard to |
| 31 | ;; know which ones you haven't set yet, and which may now be overriding some | 31 | ;; know which ones you haven't set yet, and which may now be overriding some |
| 32 | ;; new default in a new emacs version. This module aims to solve that | 32 | ;; new default in a new Emacs version. This module aims to solve that |
| 33 | ;; problem. | 33 | ;; problem. |
| 34 | ;; | 34 | ;; |
| 35 | ;; Bind keys as follows in your .emacs: | 35 | ;; Bind keys as follows in your .emacs: |
| @@ -104,7 +104,7 @@ | |||
| 104 | (require 'easy-mmode) | 104 | (require 'easy-mmode) |
| 105 | 105 | ||
| 106 | (defgroup bind-key nil | 106 | (defgroup bind-key nil |
| 107 | "A simple way to manage personal keybindings" | 107 | "A simple way to manage personal keybindings." |
| 108 | :group 'emacs) | 108 | :group 'emacs) |
| 109 | 109 | ||
| 110 | (defcustom bind-key-column-widths '(18 . 40) | 110 | (defcustom bind-key-column-widths '(18 . 40) |
| @@ -127,7 +127,7 @@ | |||
| 127 | ;; Create override-global-mode to force key remappings | 127 | ;; Create override-global-mode to force key remappings |
| 128 | 128 | ||
| 129 | (defvar override-global-map (make-keymap) | 129 | (defvar override-global-map (make-keymap) |
| 130 | "override-global-mode keymap") | 130 | "Keymap for `override-global-mode'.") |
| 131 | 131 | ||
| 132 | (define-minor-mode override-global-mode | 132 | (define-minor-mode override-global-mode |
| 133 | "A minor mode so that keymap settings override other modes." | 133 | "A minor mode so that keymap settings override other modes." |
| @@ -150,7 +150,7 @@ Elements have the form ((KEY . [MAP]) CMD ORIGINAL-CMD)") | |||
| 150 | 150 | ||
| 151 | KEY-NAME may be a vector, in which case it is passed straight to | 151 | KEY-NAME may be a vector, in which case it is passed straight to |
| 152 | `define-key'. Or it may be a string to be interpreted as | 152 | `define-key'. Or it may be a string to be interpreted as |
| 153 | spelled-out keystrokes, e.g., \"C-c C-z\". See documentation of | 153 | spelled-out keystrokes, e.g., `C-c C-z'. See documentation of |
| 154 | `edmacro-mode' for details. | 154 | `edmacro-mode' for details. |
| 155 | 155 | ||
| 156 | COMMAND must be an interactive function or lambda form. | 156 | COMMAND must be an interactive function or lambda form. |
| @@ -223,11 +223,11 @@ See `bind-key' for more details." | |||
| 223 | In contrast to `define-key', this function removes the binding from the keymap." | 223 | In contrast to `define-key', this function removes the binding from the keymap." |
| 224 | (define-key keymap key nil) | 224 | (define-key keymap key nil) |
| 225 | ;; Split M-key in ESC key | 225 | ;; Split M-key in ESC key |
| 226 | (setq key (mapcan (lambda (k) | 226 | (setq key (cl-mapcan (lambda (k) |
| 227 | (if (and (integerp k) (/= (logand k ?\M-\0) 0)) | 227 | (if (and (integerp k) (/= (logand k ?\M-\0) 0)) |
| 228 | (list ?\e (logxor k ?\M-\0)) | 228 | (list ?\e (logxor k ?\M-\0)) |
| 229 | (list k))) | 229 | (list k))) |
| 230 | key)) | 230 | key)) |
| 231 | ;; Delete single keys directly | 231 | ;; Delete single keys directly |
| 232 | (if (= (length key) 1) | 232 | (if (= (length key) 1) |
| 233 | (delete key keymap) | 233 | (delete key keymap) |
| @@ -241,7 +241,7 @@ In contrast to `define-key', this function removes the binding from the keymap." | |||
| 241 | (delete (last key) submap) | 241 | (delete (last key) submap) |
| 242 | ;; Delete submap if it is empty | 242 | ;; Delete submap if it is empty |
| 243 | (when (= 1 (length submap)) | 243 | (when (= 1 (length submap)) |
| 244 | (bind-key--remove prefix keymap))))) | 244 | (bind-key--remove prefix keymap))))) |
| 245 | 245 | ||
| 246 | ;;;###autoload | 246 | ;;;###autoload |
| 247 | (defmacro bind-key* (key-name command &optional predicate) | 247 | (defmacro bind-key* (key-name command &optional predicate) |
diff --git a/lisp/use-package/use-package-bind-key.el b/lisp/use-package/use-package-bind-key.el index 7c79f450831..460d6255e93 100644 --- a/lisp/use-package/use-package-bind-key.el +++ b/lisp/use-package/use-package-bind-key.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; use-package-bind-key.el --- Support for the :bind/:bind-keymap keywords -*- lexical-binding: t; -*- | 1 | ;;; use-package-bind-key.el --- Support for the :bind/:bind-keymap keywords -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2012-2017 John Wiegley | 3 | ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@newartisans.com> | 5 | ;; Author: John Wiegley <johnw@newartisans.com> |
| 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> | 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> |
| @@ -29,7 +29,7 @@ | |||
| 29 | ;;; Commentary: | 29 | ;;; Commentary: |
| 30 | 30 | ||
| 31 | ;; Provides support for the :bind, :bind*, :bind-keymap and :bind-keymap* | 31 | ;; Provides support for the :bind, :bind*, :bind-keymap and :bind-keymap* |
| 32 | ;; keywords. Note that these are currently still baked into | 32 | ;; keywords. Note that these are currently still baked into |
| 33 | ;; `use-package-keywords' and `use-package-deferring-keywords', although this | 33 | ;; `use-package-keywords' and `use-package-deferring-keywords', although this |
| 34 | ;; is harmless if they are never used. | 34 | ;; is harmless if they are never used. |
| 35 | 35 | ||
diff --git a/lisp/use-package/use-package-chords.el b/lisp/use-package/use-package-chords.el index cf390dbe593..4a4d9e7fea7 100644 --- a/lisp/use-package/use-package-chords.el +++ b/lisp/use-package/use-package-chords.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; use-package-chords.el --- key-chord keyword for use-package -*- lexical-binding: t; -*- | 1 | ;;; use-package-chords.el --- key-chord keyword for use-package -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2015-2019 Justin Talbott | 3 | ;; Copyright (C) 2015-2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Justin Talbott <justin@waymondo.com> | 5 | ;; Author: Justin Talbott <justin@waymondo.com> |
| 6 | ;; Keywords: convenience, tools, extensions | 6 | ;; Keywords: convenience, tools, extensions |
diff --git a/lisp/use-package/use-package-core.el b/lisp/use-package/use-package-core.el index dc9b77bc5bf..429b108ac71 100644 --- a/lisp/use-package/use-package-core.el +++ b/lisp/use-package/use-package-core.el | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | ;;; use-package-core.el --- A configuration macro for simplifying your .emacs -*- lexical-binding: t; -*- | 1 | ;;; use-package-core.el --- A configuration macro for simplifying your .emacs -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2012-2017 John Wiegley | 3 | ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@newartisans.com> | 5 | ;; Author: John Wiegley <johnw@newartisans.com> |
| 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> | 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> |
| 7 | ;; Created: 17 Jun 2012 | 7 | ;; Created: 17 Jun 2012 |
| 8 | ;; Modified: 29 Nov 2017 | 8 | ;; Modified: 29 Nov 2017 |
| 9 | ;; Version: 2.4.1 | 9 | ;; Version: 2.4.4 |
| 10 | ;; Package-Requires: ((emacs "24.3")) | 10 | ;; Package-Requires: ((emacs "24.3")) |
| 11 | ;; Keywords: dotemacs startup speed config package | 11 | ;; Keywords: dotemacs startup speed config package |
| 12 | ;; URL: https://github.com/jwiegley/use-package | 12 | ;; URL: https://github.com/jwiegley/use-package |
| @@ -53,21 +53,28 @@ | |||
| 53 | ;; iterating over them to "disable all themes" won't disable it. | 53 | ;; iterating over them to "disable all themes" won't disable it. |
| 54 | (setq custom-enabled-themes (remq 'use-package custom-enabled-themes)) | 54 | (setq custom-enabled-themes (remq 'use-package custom-enabled-themes)) |
| 55 | 55 | ||
| 56 | (if (and (eq emacs-major-version 24) (eq emacs-minor-version 3)) | 56 | (eval-when-compile |
| 57 | (defsubst hash-table-keys (hash-table) | 57 | (if (and (eq emacs-major-version 24) (eq emacs-minor-version 3)) |
| 58 | "Return a list of keys in HASH-TABLE." | 58 | (progn |
| 59 | (cl-loop for k being the hash-keys of hash-table collect k)) | 59 | (defsubst hash-table-keys (hash-table) |
| 60 | (eval-when-compile (require 'subr-x))) | 60 | "Return a list of keys in HASH-TABLE." |
| 61 | (cl-loop for k being the hash-keys of hash-table collect k)) | ||
| 62 | (defsubst string-suffix-p (suffix string &optional ignore-case) | ||
| 63 | (let ((start-pos (- (length string) (length suffix)))) | ||
| 64 | (and (>= start-pos 0) | ||
| 65 | (eq t (compare-strings suffix nil nil | ||
| 66 | string start-pos nil ignore-case)))))) | ||
| 67 | (require 'subr-x))) | ||
| 61 | 68 | ||
| 62 | (eval-when-compile | 69 | (eval-when-compile |
| 63 | (require 'regexp-opt)) | 70 | (require 'regexp-opt)) |
| 64 | 71 | ||
| 65 | (defgroup use-package nil | 72 | (defgroup use-package nil |
| 66 | "A use-package declaration for simplifying your `.emacs'." | 73 | "A `use-package' declaration for simplifying your `.emacs'." |
| 67 | :group 'startup) | 74 | :group 'startup) |
| 68 | 75 | ||
| 69 | (defconst use-package-version "2.4.1" | 76 | (defconst use-package-version "2.4.4" |
| 70 | "This version of use-package.") | 77 | "This version of `use-package'.") |
| 71 | 78 | ||
| 72 | (defcustom use-package-keywords | 79 | (defcustom use-package-keywords |
| 73 | '(:disabled | 80 | '(:disabled |
| @@ -94,6 +101,7 @@ | |||
| 94 | ;; Any other keyword that also declares commands to be autoloaded (such as | 101 | ;; Any other keyword that also declares commands to be autoloaded (such as |
| 95 | ;; :bind) must appear before this keyword. | 102 | ;; :bind) must appear before this keyword. |
| 96 | :commands | 103 | :commands |
| 104 | :autoload | ||
| 97 | :init | 105 | :init |
| 98 | :defer | 106 | :defer |
| 99 | :demand | 107 | :demand |
| @@ -105,13 +113,13 @@ | |||
| 105 | "The set of valid keywords, in the order they are processed in. | 113 | "The set of valid keywords, in the order they are processed in. |
| 106 | The order of this list is *very important*, so it is only | 114 | The order of this list is *very important*, so it is only |
| 107 | advisable to insert new keywords, never to delete or reorder | 115 | advisable to insert new keywords, never to delete or reorder |
| 108 | them. Further, attention should be paid to the NEWS.md if the | 116 | them. Further, attention should be paid to the NEWS.md if the |
| 109 | default order ever changes, as they may have subtle effects on | 117 | default order ever changes, as they may have subtle effects on |
| 110 | the semantics of use-package declarations and may necessitate | 118 | the semantics of `use-package' declarations and may necessitate |
| 111 | changing where you had inserted a new keyword earlier. | 119 | changing where you had inserted a new keyword earlier. |
| 112 | 120 | ||
| 113 | Note that `:disabled' is special in this list, as it causes | 121 | Note that `:disabled' is special in this list, as it causes |
| 114 | nothing at all to happen, even if the rest of the use-package | 122 | nothing at all to happen, even if the rest of the `use-package' |
| 115 | declaration is incorrect." | 123 | declaration is incorrect." |
| 116 | :type '(repeat symbol) | 124 | :type '(repeat symbol) |
| 117 | :group 'use-package) | 125 | :group 'use-package) |
| @@ -119,7 +127,8 @@ declaration is incorrect." | |||
| 119 | (defcustom use-package-deferring-keywords | 127 | (defcustom use-package-deferring-keywords |
| 120 | '(:bind-keymap | 128 | '(:bind-keymap |
| 121 | :bind-keymap* | 129 | :bind-keymap* |
| 122 | :commands) | 130 | :commands |
| 131 | :autoload) | ||
| 123 | "Unless `:demand' is used, keywords in this list imply deferred loading. | 132 | "Unless `:demand' is used, keywords in this list imply deferred loading. |
| 124 | The reason keywords like `:hook' are not in this list is that | 133 | The reason keywords like `:hook' are not in this list is that |
| 125 | they only imply deferred loading if they reference actual | 134 | they only imply deferred loading if they reference actual |
| @@ -130,9 +139,9 @@ otherwise requested." | |||
| 130 | :group 'use-package) | 139 | :group 'use-package) |
| 131 | 140 | ||
| 132 | (defcustom use-package-ignore-unknown-keywords nil | 141 | (defcustom use-package-ignore-unknown-keywords nil |
| 133 | "If non-nil, issue warning instead of error when unknown | 142 | "If non-nil, warn instead of signaling error for unknown keywords. |
| 134 | keyword is encountered. The unknown keyword and its associated | 143 | The unknown keyword and its associated arguments will be ignored |
| 135 | arguments will be ignored in the `use-package' expansion." | 144 | in the `use-package' expansion." |
| 136 | :type 'boolean | 145 | :type 'boolean |
| 137 | :group 'use-package) | 146 | :group 'use-package) |
| 138 | 147 | ||
| @@ -147,7 +156,7 @@ call)." | |||
| 147 | "Whether to report about loading and configuration details. | 156 | "Whether to report about loading and configuration details. |
| 148 | If you customize this, then you should require the `use-package' | 157 | If you customize this, then you should require the `use-package' |
| 149 | feature in files that use `use-package', even if these files only | 158 | feature in files that use `use-package', even if these files only |
| 150 | contain compiled expansions of the macros. If you don't do so, | 159 | contain compiled expansions of the macros. If you don't do so, |
| 151 | then the expanded macros do their job silently." | 160 | then the expanded macros do their job silently." |
| 152 | :type '(choice (const :tag "Quiet, without catching errors" errors) | 161 | :type '(choice (const :tag "Quiet, without catching errors" errors) |
| 153 | (const :tag "Quiet" nil) | 162 | (const :tag "Quiet" nil) |
| @@ -194,9 +203,9 @@ Each entry in the alist is a list of three elements: | |||
| 194 | The first element is the `use-package' keyword. | 203 | The first element is the `use-package' keyword. |
| 195 | 204 | ||
| 196 | The second is a form that can be evaluated to get the default | 205 | The second is a form that can be evaluated to get the default |
| 197 | value. It can also be a function that will receive the name of | 206 | value. It can also be a function that will receive the name of |
| 198 | the use-package declaration and the keyword plist given to | 207 | the `use-package' declaration and the keyword plist given to |
| 199 | `use-package', in normalized form. The value it returns should | 208 | `use-package', in normalized form. The value it returns should |
| 200 | also be in normalized form (which is sometimes *not* what one | 209 | also be in normalized form (which is sometimes *not* what one |
| 201 | would normally write in a `use-package' declaration, so use | 210 | would normally write in a `use-package' declaration, so use |
| 202 | caution). | 211 | caution). |
| @@ -204,9 +213,9 @@ caution). | |||
| 204 | The third element is a form that can be evaluated to determine | 213 | The third element is a form that can be evaluated to determine |
| 205 | whether or not to assign a default value; if it evaluates to nil, | 214 | whether or not to assign a default value; if it evaluates to nil, |
| 206 | then the default value is not assigned even if the keyword is not | 215 | then the default value is not assigned even if the keyword is not |
| 207 | present in the `use-package' form. This third element may also be | 216 | present in the `use-package' form. This third element may also be |
| 208 | a function, in which case it receives the name of the package (as | 217 | a function, in which case it receives the name of the package (as |
| 209 | a symbol) and a list of keywords (in normalized form). It should | 218 | a symbol) and a list of keywords (in normalized form). It should |
| 210 | return nil or non-nil depending on whether defaulting should be | 219 | return nil or non-nil depending on whether defaulting should be |
| 211 | attempted." | 220 | attempted." |
| 212 | :type `(repeat | 221 | :type `(repeat |
| @@ -291,7 +300,7 @@ This disables: | |||
| 291 | 300 | ||
| 292 | The main advantage to this variable is that, if you know your | 301 | The main advantage to this variable is that, if you know your |
| 293 | configuration works, it will make the byte-compiled file as | 302 | configuration works, it will make the byte-compiled file as |
| 294 | minimal as possible. It can also help with reading macro-expanded | 303 | minimal as possible. It can also help with reading macro-expanded |
| 295 | definitions, to understand the main intent of what's happening." | 304 | definitions, to understand the main intent of what's happening." |
| 296 | :type 'boolean | 305 | :type 'boolean |
| 297 | :group 'use-package) | 306 | :group 'use-package) |
| @@ -303,7 +312,7 @@ definitions, to understand the main intent of what's happening." | |||
| 303 | "\\s-+\\(")) | 312 | "\\s-+\\(")) |
| 304 | (or (bound-and-true-p lisp-mode-symbol-regexp) | 313 | (or (bound-and-true-p lisp-mode-symbol-regexp) |
| 305 | "\\(?:\\sw\\|\\s_\\|\\\\.\\)+") "\\)") | 314 | "\\(?:\\sw\\|\\s_\\|\\\\.\\)+") "\\)") |
| 306 | "Sexp providing regexp for finding use-package forms in user files. | 315 | "Sexp providing regexp for finding `use-package' forms in user files. |
| 307 | This is used by `use-package-jump-to-package-form' and | 316 | This is used by `use-package-jump-to-package-form' and |
| 308 | `use-package-enable-imenu-support'." | 317 | `use-package-enable-imenu-support'." |
| 309 | :type 'sexp | 318 | :type 'sexp |
| @@ -314,7 +323,7 @@ This is used by `use-package-jump-to-package-form' and | |||
| 314 | This is done by adjusting `lisp-imenu-generic-expression' to | 323 | This is done by adjusting `lisp-imenu-generic-expression' to |
| 315 | include support for finding `use-package' and `require' forms. | 324 | include support for finding `use-package' and `require' forms. |
| 316 | 325 | ||
| 317 | Must be set before loading use-package." | 326 | Must be set before loading `use-package'." |
| 318 | :type 'boolean | 327 | :type 'boolean |
| 319 | :set | 328 | :set |
| 320 | #'(lambda (sym value) | 329 | #'(lambda (sym value) |
| @@ -336,8 +345,8 @@ Must be set before loading use-package." | |||
| 336 | (font-lock-add-keywords 'emacs-lisp-mode use-package-font-lock-keywords) | 345 | (font-lock-add-keywords 'emacs-lisp-mode use-package-font-lock-keywords) |
| 337 | 346 | ||
| 338 | (defcustom use-package-compute-statistics nil | 347 | (defcustom use-package-compute-statistics nil |
| 339 | "If non-nil, compute statistics concerned use-package declarations. | 348 | "If non-nil, compute statistics concerned `use-package' declarations. |
| 340 | View the statistical report using `use-package-report'. Note that | 349 | View the statistical report using `use-package-report'. Note that |
| 341 | if this option is enabled, you must require `use-package' in your | 350 | if this option is enabled, you must require `use-package' in your |
| 342 | user init file at loadup time, or you will see errors concerning | 351 | user init file at loadup time, or you will see errors concerning |
| 343 | undefined variables." | 352 | undefined variables." |
| @@ -363,14 +372,14 @@ undefined variables." | |||
| 363 | (and sym (symbolp sym))) | 372 | (and sym (symbolp sym))) |
| 364 | 373 | ||
| 365 | (defsubst use-package-as-symbol (string-or-symbol) | 374 | (defsubst use-package-as-symbol (string-or-symbol) |
| 366 | "If STRING-OR-SYMBOL is already a symbol, return it. Otherwise | 375 | "If STRING-OR-SYMBOL is already a symbol, return it. |
| 367 | convert it to a symbol and return that." | 376 | Otherwise convert it to a symbol and return that." |
| 368 | (if (symbolp string-or-symbol) string-or-symbol | 377 | (if (symbolp string-or-symbol) string-or-symbol |
| 369 | (intern string-or-symbol))) | 378 | (intern string-or-symbol))) |
| 370 | 379 | ||
| 371 | (defsubst use-package-as-string (string-or-symbol) | 380 | (defsubst use-package-as-string (string-or-symbol) |
| 372 | "If STRING-OR-SYMBOL is already a string, return it. Otherwise | 381 | "If STRING-OR-SYMBOL is already a string, return it. |
| 373 | convert it to a string and return that." | 382 | Otherwise convert it to a string and return that." |
| 374 | (if (stringp string-or-symbol) string-or-symbol | 383 | (if (stringp string-or-symbol) string-or-symbol |
| 375 | (symbol-name string-or-symbol))) | 384 | (symbol-name string-or-symbol))) |
| 376 | 385 | ||
| @@ -736,8 +745,8 @@ one. | |||
| 736 | If AFTER is non-nil, insert KEYWORD either at the end of the | 745 | If AFTER is non-nil, insert KEYWORD either at the end of the |
| 737 | keywords list, or after the ANCHOR if one has been provided. | 746 | keywords list, or after the ANCHOR if one has been provided. |
| 738 | If TEST is non-nil, it is the test used to compare ELEM to list | 747 | If TEST is non-nil, it is the test used to compare ELEM to list |
| 739 | elements. The default is `eq'. | 748 | elements. The default is `eq'. |
| 740 | The modified list is returned. The original list is not modified." | 749 | The modified list is returned. The original list is not modified." |
| 741 | (let (result) | 750 | (let (result) |
| 742 | (dolist (k xs) | 751 | (dolist (k xs) |
| 743 | (if (funcall (or test #'eq) k anchor) | 752 | (if (funcall (or test #'eq) k anchor) |
| @@ -987,6 +996,8 @@ If RECURSED is non-nil, recurse into sublists." | |||
| 987 | ;; | 996 | ;; |
| 988 | 997 | ||
| 989 | (defun use-package-reset-statistics () | 998 | (defun use-package-reset-statistics () |
| 999 | "Reset statistics for `use-package'. | ||
| 1000 | See also `use-package-statistics'." | ||
| 990 | (interactive) | 1001 | (interactive) |
| 991 | (setq use-package-statistics (make-hash-table))) | 1002 | (setq use-package-statistics (make-hash-table))) |
| 992 | 1003 | ||
| @@ -1029,7 +1040,7 @@ The information is formatted in a way suitable for | |||
| 1029 | (format "%.2f" (use-package-statistics-time statistics)))))) | 1040 | (format "%.2f" (use-package-statistics-time statistics)))))) |
| 1030 | 1041 | ||
| 1031 | (defun use-package-report () | 1042 | (defun use-package-report () |
| 1032 | "Show current statistics gathered about use-package declarations. | 1043 | "Show current statistics gathered about `use-package' declarations. |
| 1033 | In the table that's generated, the status field has the following | 1044 | In the table that's generated, the status field has the following |
| 1034 | meaning: | 1045 | meaning: |
| 1035 | Configured :config has been processed (the package is loaded!) | 1046 | Configured :config has been processed (the package is loaded!) |
| @@ -1053,7 +1064,7 @@ meaning: | |||
| 1053 | 1064 | ||
| 1054 | (define-derived-mode use-package-statistics-mode tabulated-list-mode | 1065 | (define-derived-mode use-package-statistics-mode tabulated-list-mode |
| 1055 | "use-package statistics" | 1066 | "use-package statistics" |
| 1056 | "Show current statistics gathered about use-package declarations." | 1067 | "Show current statistics gathered about `use-package' declarations." |
| 1057 | (setq tabulated-list-format | 1068 | (setq tabulated-list-format |
| 1058 | ;; The sum of column width is 80 characters: | 1069 | ;; The sum of column width is 80 characters: |
| 1059 | [("Package" 25 t) | 1070 | [("Package" 25 t) |
| @@ -1347,6 +1358,28 @@ meaning: | |||
| 1347 | (delete-dups arg))) | 1358 | (delete-dups arg))) |
| 1348 | (use-package-process-keywords name rest state))) | 1359 | (use-package-process-keywords name rest state))) |
| 1349 | 1360 | ||
| 1361 | ;;;; :autoload | ||
| 1362 | |||
| 1363 | (defalias 'use-package-normalize/:autoload 'use-package-normalize/:commands) | ||
| 1364 | |||
| 1365 | (defun use-package-handler/:autoload (name _keyword arg rest state) | ||
| 1366 | (use-package-concat | ||
| 1367 | ;; Since we deferring load, establish any necessary autoloads, and also | ||
| 1368 | ;; keep the byte-compiler happy. | ||
| 1369 | (let ((name-string (use-package-as-string name))) | ||
| 1370 | (cl-mapcan | ||
| 1371 | #'(lambda (command) | ||
| 1372 | (when (symbolp command) | ||
| 1373 | (append | ||
| 1374 | (unless (plist-get state :demand) | ||
| 1375 | `((unless (fboundp ',command) | ||
| 1376 | (autoload #',command ,name-string)))) | ||
| 1377 | (when (bound-and-true-p byte-compile-current-file) | ||
| 1378 | `((eval-when-compile | ||
| 1379 | (declare-function ,command ,name-string))))))) | ||
| 1380 | (delete-dups arg))) | ||
| 1381 | (use-package-process-keywords name rest state))) | ||
| 1382 | |||
| 1350 | ;;;; :defer | 1383 | ;;;; :defer |
| 1351 | 1384 | ||
| 1352 | (defalias 'use-package-normalize/:defer 'use-package-normalize-predicate) | 1385 | (defalias 'use-package-normalize/:defer 'use-package-normalize-predicate) |
| @@ -1477,7 +1510,7 @@ no keyword implies `:all'." | |||
| 1477 | (defun use-package-normalize/:custom-face (name-symbol _keyword arg) | 1510 | (defun use-package-normalize/:custom-face (name-symbol _keyword arg) |
| 1478 | "Normalize use-package custom-face keyword." | 1511 | "Normalize use-package custom-face keyword." |
| 1479 | (let ((error-msg | 1512 | (let ((error-msg |
| 1480 | (format "%s wants a (<symbol> <face-spec>) or list of these" | 1513 | (format "%s wants a (<symbol> <face-spec> [spec-type]) or list of these" |
| 1481 | name-symbol))) | 1514 | name-symbol))) |
| 1482 | (unless (listp arg) | 1515 | (unless (listp arg) |
| 1483 | (use-package-error error-msg)) | 1516 | (use-package-error error-msg)) |
| @@ -1488,13 +1521,13 @@ no keyword implies `:all'." | |||
| 1488 | (spec (nth 1 def))) | 1521 | (spec (nth 1 def))) |
| 1489 | (when (or (not face) | 1522 | (when (or (not face) |
| 1490 | (not spec) | 1523 | (not spec) |
| 1491 | (> (length def) 2)) | 1524 | (> (length def) 3)) |
| 1492 | (use-package-error error-msg)))))) | 1525 | (use-package-error error-msg)))))) |
| 1493 | 1526 | ||
| 1494 | (defun use-package-handler/:custom-face (name _keyword args rest state) | 1527 | (defun use-package-handler/:custom-face (name _keyword args rest state) |
| 1495 | "Generate use-package custom-face keyword code." | 1528 | "Generate use-package custom-face keyword code." |
| 1496 | (use-package-concat | 1529 | (use-package-concat |
| 1497 | (mapcar #'(lambda (def) `(custom-set-faces (backquote ,def))) args) | 1530 | (mapcar #'(lambda (def) `(apply #'face-spec-set (backquote ,def))) args) |
| 1498 | (use-package-process-keywords name rest state))) | 1531 | (use-package-process-keywords name rest state))) |
| 1499 | 1532 | ||
| 1500 | ;;;; :init | 1533 | ;;;; :init |
| @@ -1633,6 +1666,7 @@ this file. Usage: | |||
| 1633 | package. This is useful if the package is being lazily | 1666 | package. This is useful if the package is being lazily |
| 1634 | loaded, and you wish to conditionally call functions in your | 1667 | loaded, and you wish to conditionally call functions in your |
| 1635 | `:init' block that are defined in the package. | 1668 | `:init' block that are defined in the package. |
| 1669 | :autoload Similar to :commands, but it for no-interactive one. | ||
| 1636 | :hook Specify hook(s) to attach this package to. | 1670 | :hook Specify hook(s) to attach this package to. |
| 1637 | 1671 | ||
| 1638 | :bind Bind keys, and define autoloads for the bound commands. | 1672 | :bind Bind keys, and define autoloads for the bound commands. |
diff --git a/lisp/use-package/use-package-delight.el b/lisp/use-package/use-package-delight.el index 85d5c7cb4d6..558be5e4706 100644 --- a/lisp/use-package/use-package-delight.el +++ b/lisp/use-package/use-package-delight.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; use-package-delight.el --- Support for the :delight keyword -*- lexical-binding: t; -*- | 1 | ;;; use-package-delight.el --- Support for the :delight keyword -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2012-2017 John Wiegley | 3 | ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@newartisans.com> | 5 | ;; Author: John Wiegley <johnw@newartisans.com> |
| 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> | 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> |
diff --git a/lisp/use-package/use-package-diminish.el b/lisp/use-package/use-package-diminish.el index 1f3895f42cd..5b20830ee6a 100644 --- a/lisp/use-package/use-package-diminish.el +++ b/lisp/use-package/use-package-diminish.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; use-package-diminish.el --- Support for the :diminish keyword -*- lexical-binding: t; -*- | 1 | ;;; use-package-diminish.el --- Support for the :diminish keyword -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2012-2017 John Wiegley | 3 | ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@newartisans.com> | 5 | ;; Author: John Wiegley <johnw@newartisans.com> |
| 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> | 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> |
diff --git a/lisp/use-package/use-package-ensure-system-package.el b/lisp/use-package/use-package-ensure-system-package.el index 7c591af7d9b..c42996f9d2a 100644 --- a/lisp/use-package/use-package-ensure-system-package.el +++ b/lisp/use-package/use-package-ensure-system-package.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; use-package-ensure-system-package.el --- auto install system packages -*- lexical-binding: t; -*- | 1 | ;;; use-package-ensure-system-package.el --- auto install system packages -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2017 Justin Talbott | 3 | ;; Copyright (C) 2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Justin Talbott <justin@waymondo.com> | 5 | ;; Author: Justin Talbott <justin@waymondo.com> |
| 6 | ;; Keywords: convenience, tools, extensions | 6 | ;; Keywords: convenience, tools, extensions |
| @@ -29,7 +29,7 @@ | |||
| 29 | "List of custom packages installed.") | 29 | "List of custom packages installed.") |
| 30 | 30 | ||
| 31 | (defun use-package-ensure-system-package-consify (arg) | 31 | (defun use-package-ensure-system-package-consify (arg) |
| 32 | "Turn `arg' into a cons of (`package-name' . `install-command')." | 32 | "Turn ARG into a cons of (`package-name' . `install-command')." |
| 33 | (cond | 33 | (cond |
| 34 | ((stringp arg) | 34 | ((stringp arg) |
| 35 | (cons arg `(system-packages-install ,arg))) | 35 | (cons arg `(system-packages-install ,arg))) |
| @@ -54,7 +54,7 @@ | |||
| 54 | 54 | ||
| 55 | ;;;###autoload | 55 | ;;;###autoload |
| 56 | (defun use-package-normalize/:ensure-system-package (_name-symbol keyword args) | 56 | (defun use-package-normalize/:ensure-system-package (_name-symbol keyword args) |
| 57 | "Turn `arg' into a list of cons-es of (`package-name' . `install-command')." | 57 | "Turn ARGS into a list of conses of (`package-name' . `install-command')." |
| 58 | (use-package-as-one (symbol-name keyword) args | 58 | (use-package-as-one (symbol-name keyword) args |
| 59 | (lambda (_label arg) | 59 | (lambda (_label arg) |
| 60 | (cond | 60 | (cond |
diff --git a/lisp/use-package/use-package-ensure.el b/lisp/use-package/use-package-ensure.el index cb31b4b7dd4..a879c294dc3 100644 --- a/lisp/use-package/use-package-ensure.el +++ b/lisp/use-package/use-package-ensure.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; use-package-ensure.el --- Support for the :ensure and :pin keywords -*- lexical-binding: t; -*- | 1 | ;;; use-package-ensure.el --- Support for the :ensure and :pin keywords -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2012-2017 John Wiegley | 3 | ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@newartisans.com> | 5 | ;; Author: John Wiegley <johnw@newartisans.com> |
| 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> | 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> |
| @@ -37,7 +37,7 @@ | |||
| 37 | (require 'use-package-core) | 37 | (require 'use-package-core) |
| 38 | 38 | ||
| 39 | (defgroup use-package-ensure nil | 39 | (defgroup use-package-ensure nil |
| 40 | "Support for :ensure and :pin keywords in use-package declarations." | 40 | "Support for :ensure and :pin keywords in `use-package' declarations." |
| 41 | :group 'use-package) | 41 | :group 'use-package) |
| 42 | 42 | ||
| 43 | (eval-when-compile | 43 | (eval-when-compile |
| @@ -64,7 +64,7 @@ to all `:ensure' keywords (always a list, even if only one); and | |||
| 64 | the current `state' plist created by previous handlers. | 64 | the current `state' plist created by previous handlers. |
| 65 | 65 | ||
| 66 | Note that this function is called whenever `:ensure' is provided, | 66 | Note that this function is called whenever `:ensure' is provided, |
| 67 | even if it is nil. It is up to the function to decide on the | 67 | even if it is nil. It is up to the function to decide on the |
| 68 | semantics of the various values for `:ensure'. | 68 | semantics of the various values for `:ensure'. |
| 69 | 69 | ||
| 70 | This function should return non-nil if the package is installed. | 70 | This function should return non-nil if the package is installed. |
| @@ -111,7 +111,7 @@ manually updated package." | |||
| 111 | (archive-name (if (stringp archive) archive (symbol-name archive)))) | 111 | (archive-name (if (stringp archive) archive (symbol-name archive)))) |
| 112 | (if (use-package-archive-exists-p archive-symbol) | 112 | (if (use-package-archive-exists-p archive-symbol) |
| 113 | (add-to-list 'package-pinned-packages (cons package archive-name)) | 113 | (add-to-list 'package-pinned-packages (cons package archive-name)) |
| 114 | (error "Archive '%s' requested for package '%s' is not available." | 114 | (error "Archive '%s' requested for package '%s' is not available" |
| 115 | archive-name package)) | 115 | archive-name package)) |
| 116 | (unless (bound-and-true-p package--initialized) | 116 | (unless (bound-and-true-p package--initialized) |
| 117 | (package-initialize t)))) | 117 | (package-initialize t)))) |
diff --git a/lisp/use-package/use-package-jump.el b/lisp/use-package/use-package-jump.el index 4044ad16564..6b9c02808e1 100644 --- a/lisp/use-package/use-package-jump.el +++ b/lisp/use-package/use-package-jump.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; use-package-jump.el --- Attempt to jump to a use-package declaration -*- lexical-binding: t; -*- | 1 | ;;; use-package-jump.el --- Attempt to jump to a use-package declaration -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2012-2017 John Wiegley | 3 | ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@newartisans.com> | 5 | ;; Author: John Wiegley <johnw@newartisans.com> |
| 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> | 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> |
| @@ -30,8 +30,8 @@ | |||
| 30 | 30 | ||
| 31 | ;; Provides the command `M-x use-package-jump-to-package-form', however it | 31 | ;; Provides the command `M-x use-package-jump-to-package-form', however it |
| 32 | ;; only works if the package being jumped to was required during | 32 | ;; only works if the package being jumped to was required during |
| 33 | ;; initialization. If it was delay-loaded, it will not work. Improvements are | 33 | ;; initialization. If it was delay-loaded, it will not work. |
| 34 | ;; needed. | 34 | ;; Improvements are needed. |
| 35 | 35 | ||
| 36 | ;;; Code: | 36 | ;;; Code: |
| 37 | 37 | ||
| @@ -48,11 +48,10 @@ Returns an absolute file path or nil if none is found." | |||
| 48 | 48 | ||
| 49 | ;;;###autoload | 49 | ;;;###autoload |
| 50 | (defun use-package-jump-to-package-form (package) | 50 | (defun use-package-jump-to-package-form (package) |
| 51 | "Attempt to find and jump to the `use-package' form that loaded | 51 | "Attempt to find and jump to the `use-package' form that loaded PACKAGE. |
| 52 | PACKAGE. This will only find the form if that form actually | 52 | This will only find the form if that form actually required |
| 53 | required PACKAGE. If PACKAGE was previously required then this | 53 | PACKAGE. If PACKAGE was previously required then this function |
| 54 | function will jump to the file that originally required PACKAGE | 54 | will jump to the file that originally required PACKAGE instead." |
| 55 | instead." | ||
| 56 | (interactive (list (completing-read "Package: " features))) | 55 | (interactive (list (completing-read "Package: " features))) |
| 57 | (let* ((package (if (stringp package) (intern package) package)) | 56 | (let* ((package (if (stringp package) (intern package) package)) |
| 58 | (requiring-file (use-package-find-require package)) | 57 | (requiring-file (use-package-find-require package)) |
diff --git a/lisp/use-package/use-package-lint.el b/lisp/use-package/use-package-lint.el index c6e7c3c0ce2..12974ab15e4 100644 --- a/lisp/use-package/use-package-lint.el +++ b/lisp/use-package/use-package-lint.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; use-package-lint.el --- Attempt to find errors in use-package declarations -*- lexical-binding: t; -*- | 1 | ;;; use-package-lint.el --- Attempt to find errors in use-package declarations -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2012-2017 John Wiegley | 3 | ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@newartisans.com> | 5 | ;; Author: John Wiegley <johnw@newartisans.com> |
| 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> | 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> |
| @@ -63,7 +63,7 @@ | |||
| 63 | 63 | ||
| 64 | ;;;###autoload | 64 | ;;;###autoload |
| 65 | (defun use-package-lint () | 65 | (defun use-package-lint () |
| 66 | "Check for errors in use-package declarations. | 66 | "Check for errors in `use-package' declarations. |
| 67 | For example, if the module's `:if' condition is met, but even | 67 | For example, if the module's `:if' condition is met, but even |
| 68 | with the specified `:load-path' the module cannot be found." | 68 | with the specified `:load-path' the module cannot be found." |
| 69 | (interactive) | 69 | (interactive) |
diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el index 0e194d5f182..9d046e0b149 100644 --- a/lisp/use-package/use-package.el +++ b/lisp/use-package/use-package.el | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | ;;; use-package.el --- A configuration macro for simplifying your .emacs -*- lexical-binding: t; -*- | 1 | ;;; use-package.el --- A configuration macro for simplifying your .emacs -*- lexical-binding: t; -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2012-2017 John Wiegley | 3 | ;; Copyright (C) 2012-2022 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: John Wiegley <johnw@newartisans.com> | 5 | ;; Author: John Wiegley <johnw@newartisans.com> |
| 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> | 6 | ;; Maintainer: John Wiegley <johnw@newartisans.com> |
| 7 | ;; Created: 17 Jun 2012 | 7 | ;; Created: 17 Jun 2012 |
| 8 | ;; Modified: 29 Nov 2017 | 8 | ;; Modified: 29 Nov 2017 |
| 9 | ;; Version: 2.4.1 | 9 | ;; Version: 2.4.4 |
| 10 | ;; Package-Requires: ((emacs "24.3") (bind-key "2.4")) | 10 | ;; Package-Requires: ((emacs "24.3") (bind-key "2.4")) |
| 11 | ;; Keywords: dotemacs startup speed config package | 11 | ;; Keywords: dotemacs startup speed config package |
| 12 | ;; URL: https://github.com/jwiegley/use-package | 12 | ;; URL: https://github.com/jwiegley/use-package |
diff --git a/test/lisp/use-package/use-package-chords-tests.el b/test/lisp/use-package/use-package-chords-tests.el index 3c3dc4b4fe0..2b7588dd807 100644 --- a/test/lisp/use-package/use-package-chords-tests.el +++ b/test/lisp/use-package/use-package-chords-tests.el | |||
| @@ -158,4 +158,4 @@ | |||
| 158 | ;; no-update-autoloads: t | 158 | ;; no-update-autoloads: t |
| 159 | ;; End: | 159 | ;; End: |
| 160 | 160 | ||
| 161 | ;;; use-package-tests.el ends here | 161 | ;;; use-package-chords-tests.el ends here |
diff --git a/test/lisp/use-package/use-package-tests.el b/test/lisp/use-package/use-package-tests.el index 007d2b07ac8..709c1988ffb 100644 --- a/test/lisp/use-package/use-package-tests.el +++ b/test/lisp/use-package/use-package-tests.el | |||
| @@ -875,6 +875,12 @@ | |||
| 875 | (gnus-harvest-install)) | 875 | (gnus-harvest-install)) |
| 876 | t)))) | 876 | t)))) |
| 877 | 877 | ||
| 878 | (ert-deftest use-package-test/:autoload-1 () | ||
| 879 | (match-expansion | ||
| 880 | (use-package foo :autoload bar) | ||
| 881 | `(unless (fboundp 'bar) | ||
| 882 | (autoload #'bar "foo")))) | ||
| 883 | |||
| 878 | (ert-deftest use-package-test/:defines-1 () | 884 | (ert-deftest use-package-test/:defines-1 () |
| 879 | (match-expansion | 885 | (match-expansion |
| 880 | (use-package foo :defines bar) | 886 | (use-package foo :defines bar) |
| @@ -1150,7 +1156,7 @@ | |||
| 1150 | (match-expansion | 1156 | (match-expansion |
| 1151 | (use-package foo :custom-face (foo ((t (:background "#e4edfc"))))) | 1157 | (use-package foo :custom-face (foo ((t (:background "#e4edfc"))))) |
| 1152 | `(progn | 1158 | `(progn |
| 1153 | (custom-set-faces (backquote (foo ((t (:background "#e4edfc")))))) | 1159 | (apply #'face-spec-set (backquote (foo ((t (:background "#e4edfc")))))) |
| 1154 | (require 'foo nil nil)))) | 1160 | (require 'foo nil nil)))) |
| 1155 | 1161 | ||
| 1156 | (ert-deftest use-package-test/:custom-face-2 () | 1162 | (ert-deftest use-package-test/:custom-face-2 () |
| @@ -1160,11 +1166,18 @@ | |||
| 1160 | (example-1-face ((t (:foreground "LightPink")))) | 1166 | (example-1-face ((t (:foreground "LightPink")))) |
| 1161 | (example-2-face ((t (:foreground "LightGreen"))))) | 1167 | (example-2-face ((t (:foreground "LightGreen"))))) |
| 1162 | `(progn | 1168 | `(progn |
| 1163 | (custom-set-faces | 1169 | (apply #'face-spec-set |
| 1164 | (backquote (example-1-face ((t (:foreground "LightPink")))))) | 1170 | (backquote (example-1-face ((t (:foreground "LightPink")))))) |
| 1165 | (custom-set-faces | 1171 | (apply #'face-spec-set |
| 1166 | (backquote (example-2-face ((t (:foreground "LightGreen")))))) | 1172 | (backquote (example-2-face ((t (:foreground "LightGreen")))))) |
| 1167 | (require 'example nil nil)))) | 1173 | (require 'example nil nil)))) |
| 1174 | |||
| 1175 | (ert-deftest use-package-test/:custom-face-3 () | ||
| 1176 | (match-expansion | ||
| 1177 | (use-package foo :custom-face (foo ((t (:background "#e4edfc"))) face-defspec-spec)) | ||
| 1178 | `(progn | ||
| 1179 | (apply #'face-spec-set (backquote (foo ((t (:background "#e4edfc"))) face-defspec-spec))) | ||
| 1180 | (require 'foo nil nil)))) | ||
| 1168 | 1181 | ||
| 1169 | (ert-deftest use-package-test/:init-1 () | 1182 | (ert-deftest use-package-test/:init-1 () |
| 1170 | (match-expansion | 1183 | (match-expansion |