diff options
| author | John Wiegley | 2022-11-15 08:26:03 -0800 |
|---|---|---|
| committer | GitHub | 2022-11-15 08:26:03 -0800 |
| commit | cf8ab8b52eae65a108d899e896e1171355122bb7 (patch) | |
| tree | 1f7f09a99f93707a7d9e2d1ad7955febe8f13c05 | |
| parent | 9b476ae71c72239e02af4f98bd7eba0cb243bd0a (diff) | |
| parent | 2efc8698666de67d07c3d7f21464d6378d18adc3 (diff) | |
| download | emacs-cf8ab8b52eae65a108d899e896e1171355122bb7.tar.gz emacs-cf8ab8b52eae65a108d899e896e1171355122bb7.zip | |
Merge pull request from skangas/texinfo-wip
GitHub-reference: https://github.com/jwiegley/use-package/issues/1018
| -rw-r--r-- | doc/misc/use-package.texi | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/doc/misc/use-package.texi b/doc/misc/use-package.texi index de6351c592f..573baac89aa 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 |
| @@ -73,27 +73,27 @@ Installation | |||
| 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{} |
| @@ -127,10 +127,10 @@ its development repository. | |||
| 127 | @node Installing from GNU ELPA | 127 | @node Installing from GNU ELPA |
| 128 | @section Installing from GNU ELPA | 128 | @section Installing from GNU ELPA |
| 129 | 129 | ||
| 130 | use-package is available from GNU ELPA. If you haven't used Emacs' | 130 | use-package is available from GNU ELPA. If you haven't used |
| 131 | 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,}. | 133 | @ref{Packages,,,emacs,}. Then add one of the archives to @code{package-archives}: |
| 134 | 134 | ||
| 135 | First, you need to update the local package list using: | 135 | First, you need to update the local package list using: |
| 136 | 136 | ||
| @@ -206,7 +206,7 @@ Now see @ref{Post-Installation Tasks}. | |||
| 206 | @section Post-Installation Tasks | 206 | @section Post-Installation Tasks |
| 207 | 207 | ||
| 208 | 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 |
| 209 | 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 |
| 210 | 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}. |
| 211 | 211 | ||
| 212 | @example | 212 | @example |
| @@ -216,7 +216,7 @@ C-h v use-package-version RET | |||
| 216 | should display something like | 216 | should display something like |
| 217 | 217 | ||
| 218 | @example | 218 | @example |
| 219 | use-package-version’s value is "2.4.1" | 219 | use-package-version’s value is "2.4.3" |
| 220 | @end example | 220 | @end example |
| 221 | 221 | ||
| 222 | 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}. |
| @@ -226,13 +226,13 @@ If you run into problems, then please see the @ref{Debugging Tools}. | |||
| 226 | @node Getting Started | 226 | @node Getting Started |
| 227 | @chapter Getting Started | 227 | @chapter Getting Started |
| 228 | 228 | ||
| 229 | TODO@. For now, see @code{README.md}. | 229 | TODO@. For now, see @code{README.md}. |
| 230 | 230 | ||
| 231 | @node Basic Concepts | 231 | @node Basic Concepts |
| 232 | @chapter Basic Concepts | 232 | @chapter Basic Concepts |
| 233 | 233 | ||
| 234 | @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 |
| 235 | 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 |
| 236 | those decisions clearer: | 236 | those decisions clearer: |
| 237 | 237 | ||
| 238 | @itemize | 238 | @itemize |
| @@ -256,7 +256,7 @@ close to a functional Emacs as possible. | |||
| 256 | 256 | ||
| 257 | @item | 257 | @item |
| 258 | 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 |
| 259 | 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 |
| 260 | 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. |
| 261 | @end itemize | 261 | @end itemize |
| 262 | 262 | ||
| @@ -267,25 +267,25 @@ used for speed (reason 3), it can still be used as a sanity check. | |||
| 267 | @chapter Keywords | 267 | @chapter Keywords |
| 268 | 268 | ||
| 269 | @menu | 269 | @menu |
| 270 | * @code{after}:: | 270 | * @code{after}:: @code{after}. |
| 271 | * @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*}. |
| 272 | * @code{bind}, @code{bind*}: @code{bind} @code{bind*}. | 272 | * @code{bind} @code{bind*}:: @code{bind} @code{:bind*}. |
| 273 | * @code{commands}:: | 273 | * @code{commands}:: @code{:commands}. |
| 274 | * @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}. |
| 275 | * @code{custom}:: | 275 | * @code{custom}:: @code{:custom}. |
| 276 | * @code{custom-face}:: | 276 | * @code{custom-face}:: @code{:custom-face}. |
| 277 | * @code{defer}, @code{demand}: @code{defer} @code{demand}. | 277 | * @code{defer} @code{demand}:: @code{:defer}, @code{:demand}. |
| 278 | * @code{defines}, @code{functions}: @code{defines} @code{functions}. | 278 | * @code{defines} @code{functions}:: @code{:defines}, @code{:functions}. |
| 279 | * @code{diminish}, @code{delight}: @code{diminish} @code{delight}. | 279 | * @code{diminish} @code{delight}:: @code{:diminish}, @code{:delight}. |
| 280 | * @code{disabled}:: | 280 | * @code{disabled}:: @code{:disabled}. |
| 281 | * @code{ensure}, @code{pin}: @code{ensure} @code{pin}. | 281 | * @code{ensure} @code{pin}:: @code{:ensure}, @code{:pin}. |
| 282 | * @code{hook}:: | 282 | * @code{hook}:: @code{:hook}. |
| 283 | * @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}. |
| 284 | * @code{load-path}:: | 284 | * @code{load-path}:: @code{:load-path}. |
| 285 | * @code{mode}, @code{interpreter}: @code{mode} @code{interpreter}. | 285 | * @code{mode} @code{interpreter}:: @code{:mode}, @code{:interpreter}. |
| 286 | * @code{magic}, @code{magic-fallback}: @code{magic} @code{magic-fallback}. | 286 | * @code{magic} @code{magic-fallback}:: @code{:magic}, @code{:magic-fallback}. |
| 287 | * @code{no-require}:: | 287 | * @code{no-require}:: @code{:no-require}. |
| 288 | * @code{requires}:: | 288 | * @code{requires}:: @code{:requires}. |
| 289 | @end menu | 289 | @end menu |
| 290 | 290 | ||
| 291 | @node @code{after} | 291 | @node @code{after} |
| @@ -293,8 +293,8 @@ used for speed (reason 3), it can still be used as a sanity check. | |||
| 293 | 293 | ||
| 294 | 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 |
| 295 | 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 |
| 296 | 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 |
| 297 | 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 |
| 298 | example: | 298 | example: |
| 299 | 299 | ||
| 300 | @lisp | 300 | @lisp |
| @@ -309,13 +309,13 @@ example: | |||
| 309 | @end lisp | 309 | @end lisp |
| 310 | 310 | ||
| 311 | 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 |
| 312 | 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, |
| 313 | however, the above code becomes order-independent, without an implicit | 313 | however, the above code becomes order-independent, without an implicit |
| 314 | depedence on the nature of your init file. | 314 | depedence on the nature of your init file. |
| 315 | 315 | ||
| 316 | 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 |
| 317 | 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} |
| 318 | have been loaded. Here are some of the other possibilities: | 318 | have been loaded. Here are some of the other possibilities: |
| 319 | 319 | ||
| 320 | @lisp | 320 | @lisp |
| 321 | :after (foo bar) | 321 | :after (foo bar) |
| @@ -331,7 +331,7 @@ been loaded, or both @code{baz} and @code{quux} have been loaded. | |||
| 331 | 331 | ||
| 332 | @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 |
| 333 | 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 |
| 334 | 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 |
| 335 | 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 |
| 336 | 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 |
| 337 | those declarations, your package will never be loaded. | 337 | those declarations, your package will never be loaded. |
| @@ -340,14 +340,14 @@ those declarations, your package will never be loaded. | |||
| 340 | @section @code{:bind-keymap}, @code{:bind-keymap*} | 340 | @section @code{:bind-keymap}, @code{:bind-keymap*} |
| 341 | 341 | ||
| 342 | 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 |
| 343 | 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 |
| 344 | 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 |
| 345 | autoloaded using Emacs' @code{autoload} mechanism. | 345 | autoloaded using Emacs' @code{autoload} mechanism. |
| 346 | 346 | ||
| 347 | 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 |
| 348 | @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" |
| 349 | 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 |
| 350 | 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 |
| 351 | 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 |
| 352 | 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. |
| 353 | 353 | ||
| @@ -386,7 +386,7 @@ A more literal way to do the exact same thing is: | |||
| 386 | @end lisp | 386 | @end lisp |
| 387 | 387 | ||
| 388 | 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 |
| 389 | 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 |
| 390 | 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 |
| 391 | 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. |
| 392 | 392 | ||
| @@ -402,7 +402,7 @@ The @code{:bind} keyword takes either a cons or a list of conses: | |||
| 402 | 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. |
| 403 | 403 | ||
| 404 | 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, |
| 405 | 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 |
| 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. | 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. |
| 407 | 407 | ||
| 408 | Examples: | 408 | Examples: |
| @@ -436,7 +436,7 @@ The effect of this statement is to wait until @code{helm} has loaded, and then t | |||
| 436 | 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 |
| 437 | keymap, @code{helm-mode-map}. | 437 | keymap, @code{helm-mode-map}. |
| 438 | 438 | ||
| 439 | 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 |
| 440 | first use of @code{:map} are applied to the global keymap: | 440 | first use of @code{:map} are applied to the global keymap: |
| 441 | 441 | ||
| 442 | @lisp | 442 | @lisp |
| @@ -470,7 +470,7 @@ Here is the simplest @code{use-package} declaration: | |||
| 470 | @end lisp | 470 | @end lisp |
| 471 | 471 | ||
| 472 | 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 |
| 473 | 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 |
| 474 | 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 |
| 475 | took to load, if it took over 0.1 seconds. | 475 | took to load, if it took over 0.1 seconds. |
| 476 | 476 | ||
| @@ -544,14 +544,14 @@ The @code{:custom-face} keyword allows customization of package custom faces. | |||
| 544 | @node @code{defer} @code{demand} | 544 | @node @code{defer} @code{demand} |
| 545 | @section @code{:defer}, @code{:demand} | 545 | @section @code{:defer}, @code{:demand} |
| 546 | 546 | ||
| 547 | 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 |
| 548 | 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 |
| 549 | 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 |
| 550 | 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 |
| 551 | 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 |
| 552 | any autoloads for you. | 552 | any autoloads for you. |
| 553 | 553 | ||
| 554 | 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 |
| 555 | 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 |
| 556 | not establish an autoload for the bound key. | 556 | not establish an autoload for the bound key. |
| 557 | 557 | ||
| @@ -593,7 +593,7 @@ If you need to silence a missing function warning, you can use @code{:functions} | |||
| 593 | @section @code{:diminish}, @code{:delight} | 593 | @section @code{:diminish}, @code{:delight} |
| 594 | 594 | ||
| 595 | @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 |
| 596 | 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 |
| 597 | minor mode strings in your mode-line. | 597 | minor mode strings in your mode-line. |
| 598 | 598 | ||
| 599 | @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 |
| @@ -612,7 +612,7 @@ package name with "-mode" appended at the end: | |||
| 612 | @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 |
| 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 | 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 |
| 614 | 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 |
| 615 | 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, |
| 616 | the default mode name is hidden completely. | 616 | the default mode name is hidden completely. |
| 617 | 617 | ||
| 618 | @lisp | 618 | @lisp |
| @@ -654,7 +654,7 @@ from the output entirely, to accelerate startup times. | |||
| 654 | @node @code{ensure} @code{pin} | 654 | @node @code{ensure} @code{pin} |
| 655 | @section @code{:ensure}, @code{:pin} | 655 | @section @code{:ensure}, @code{:pin} |
| 656 | 656 | ||
| 657 | 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 |
| 658 | 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 |
| 659 | relevant packages are downloaded automatically once declared in your @code{.emacs}. | 659 | relevant packages are downloaded automatically once declared in your @code{.emacs}. |
| 660 | 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 |
| @@ -684,7 +684,7 @@ archives is also a valid use-case. | |||
| 684 | 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 |
| 685 | 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 |
| 686 | 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} |
| 687 | 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 |
| 688 | set @code{use-package-always-pin} to set a default. | 688 | set @code{use-package-always-pin} to set a default. |
| 689 | 689 | ||
| 690 | 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, |
| @@ -729,7 +729,7 @@ Example: | |||
| 729 | @section @code{:hook} | 729 | @section @code{:hook} |
| 730 | 730 | ||
| 731 | 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 |
| 732 | 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: |
| 733 | 733 | ||
| 734 | @lisp | 734 | @lisp |
| 735 | (use-package ace-jump-mode | 735 | (use-package ace-jump-mode |
| @@ -804,8 +804,8 @@ the same thing as @code{:if (not foo)}. | |||
| 804 | @section @code{:load-path} | 804 | @section @code{:load-path} |
| 805 | 805 | ||
| 806 | 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, |
| 807 | 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 |
| 808 | strings. If the path is relative, it is expanded within | 808 | strings. If the path is relative, it is expanded within |
| 809 | @code{user-emacs-directory}: | 809 | @code{user-emacs-directory}: |
| 810 | 810 | ||
| 811 | @lisp | 811 | @lisp |
| @@ -816,8 +816,8 @@ strings. If the path is relative, it is expanded within | |||
| 816 | 816 | ||
| 817 | 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 |
| 818 | 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 |
| 819 | 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 |
| 820 | 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 |
| 821 | 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 |
| 822 | up the same information again on each startup: | 822 | up the same information again on each startup: |
| 823 | 823 | ||
| @@ -836,7 +836,7 @@ up the same information again on each startup: | |||
| 836 | 836 | ||
| 837 | 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 |
| 838 | 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} |
| 839 | 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 |
| 840 | cells, or a string or regexp: | 840 | cells, or a string or regexp: |
| 841 | 841 | ||
| 842 | @lisp | 842 | @lisp |
| @@ -875,8 +875,8 @@ This does exactly the same thing as the following: | |||
| 875 | 875 | ||
| 876 | 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 |
| 877 | @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 |
| 878 | 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 |
| 879 | 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: |
| 880 | 880 | ||
| 881 | @lisp | 881 | @lisp |
| 882 | (use-package pdf-tools | 882 | (use-package pdf-tools |
| @@ -895,9 +895,9 @@ string @code{"%PDF"}. | |||
| 895 | 895 | ||
| 896 | 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 |
| 897 | 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 |
| 898 | 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 |
| 899 | 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 |
| 900 | @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 |
| 901 | such cases, use the @code{:no-require} keyword: | 901 | such cases, use the @code{:no-require} keyword: |
| 902 | 902 | ||
| 903 | @lisp | 903 | @lisp |
| @@ -913,8 +913,8 @@ such cases, use the @code{:no-require} keyword: | |||
| 913 | 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, |
| 914 | 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 |
| 915 | 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 |
| 916 | 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 |
| 917 | 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: |
| 918 | 918 | ||
| 919 | @lisp | 919 | @lisp |
| 920 | (use-package abbrev | 920 | (use-package abbrev |