2017-12-04 12:11:59 -08:00
|
|
|
\input texinfo @c -*- texinfo -*-
|
|
|
|
@c %**start of header
|
2022-12-11 01:43:25 +01:00
|
|
|
@setfilename ../../info/use-package.info
|
2017-12-04 12:11:59 -08:00
|
|
|
@settitle use-package User Manual
|
2022-12-11 01:43:25 +01:00
|
|
|
@set USEP_VER 2.4.5
|
|
|
|
@set USEP_DIST as distributed with Emacs @value{EMACSVER}
|
2022-12-08 00:47:04 +01:00
|
|
|
@include docstyle.texi
|
|
|
|
@syncodeindex vr cp
|
|
|
|
@syncodeindex fn cp
|
2022-12-11 01:43:25 +01:00
|
|
|
@include emacsver.texi
|
2017-12-04 12:11:59 -08:00
|
|
|
@c %**end of header
|
|
|
|
|
|
|
|
@copying
|
2022-12-11 01:43:25 +01:00
|
|
|
This manual is for use-package @value{USEP_VER} @value{USEP_DIST}.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2024-01-02 09:47:10 +08:00
|
|
|
Copyright @copyright{} 2022--2024 Free Software Foundation, Inc.
|
2022-04-04 21:10:44 +02:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@quotation
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
|
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
|
|
|
any later version published by the Free Software Foundation; with no
|
|
|
|
Invariant Sections, with the Front-Cover Texts being ``A GNU Manual'',
|
|
|
|
and with the Back-Cover Texts as in (a) below. A copy of the license
|
|
|
|
is included in the section entitled ``GNU Free Documentation License''.
|
|
|
|
|
|
|
|
(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
|
|
|
|
modify this GNU manual.''
|
2017-12-04 12:11:59 -08:00
|
|
|
@end quotation
|
|
|
|
@end copying
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@dircategory Emacs misc features
|
2017-12-04 12:11:59 -08:00
|
|
|
@direntry
|
|
|
|
* use-package: (use-package). Declarative package configuration for Emacs.
|
|
|
|
@end direntry
|
|
|
|
|
|
|
|
@finalout
|
|
|
|
@titlepage
|
|
|
|
@title use-package User Manual
|
2022-12-11 01:43:25 +01:00
|
|
|
@subtitle for version USEP_VER
|
2022-12-08 00:47:04 +01:00
|
|
|
@author John Wiegley & Stefan Kangas
|
2017-12-04 12:11:59 -08:00
|
|
|
@page
|
|
|
|
@vskip 0pt plus 1filll
|
|
|
|
@insertcopying
|
|
|
|
@end titlepage
|
|
|
|
|
|
|
|
@contents
|
|
|
|
|
|
|
|
@ifnottex
|
|
|
|
@node Top
|
|
|
|
@top use-package User Manual
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
The @code{use-package} macro allows you to set up package
|
2022-12-08 00:47:04 +01:00
|
|
|
customization in your init file in a declarative way. It takes care
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
of many things for you that would otherwise require a lot of
|
2022-12-08 00:47:04 +01:00
|
|
|
repetitive boilerplate code. It can help with common customization,
|
|
|
|
such as binding keys, setting up hooks, customizing user options and
|
|
|
|
faces, autoloading, and more. It also helps you keep Emacs startup
|
|
|
|
fast, even when you use many (even hundreds) of packages.
|
|
|
|
|
|
|
|
Note that use-package is not a package manager. Although use-package
|
|
|
|
does have the useful capability to interface with the Emacs package
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
manager, its primary purpose is help with the configuration and
|
|
|
|
loading of packages, not with managing their download, upgrades, and
|
|
|
|
installation.
|
2022-04-04 21:10:44 +02:00
|
|
|
|
2022-08-08 13:26:10 +02:00
|
|
|
@insertcopying
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@menu
|
2022-12-08 00:47:04 +01:00
|
|
|
* Basic Concepts:: Basic concepts of use-package.
|
|
|
|
* Getting Started:: A gentle introduction to use-package.
|
|
|
|
* Loading Packages:: How and when packages are loaded.
|
|
|
|
* Configuring Packages:: Package configuration keywords.
|
|
|
|
* Installing packages:: Ensuring packages are available.
|
|
|
|
* Byte-compiling:: Byte-compiling your init file.
|
|
|
|
* Troubleshooting:: What to do when there's trouble.
|
|
|
|
|
|
|
|
Appendices
|
|
|
|
* Keyword extensions:: Adding new use-package keywords.
|
|
|
|
* History:: History and acknowledgments.
|
|
|
|
* GNU Free Documentation License:: The license for this manual.
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
|
|
|
|
Index
|
2022-12-08 00:47:04 +01:00
|
|
|
* Index::
|
2017-12-04 12:11:59 -08:00
|
|
|
@end menu
|
2022-12-08 00:47:04 +01:00
|
|
|
@end ifnottex
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@c ----------------------------------------------------------------------------
|
|
|
|
@node Basic Concepts
|
|
|
|
@chapter Basic Concepts
|
2022-04-04 21:10:44 +02:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
use-package provides the @code{use-package} macro, that simplifies the
|
|
|
|
customization and use of packages in Emacs. It was created for a few
|
|
|
|
basic reasons, each of which drove the design. Understanding these
|
|
|
|
reasons may help make some of those decisions clearer:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex reasons for developing use-package
|
2022-12-08 00:47:04 +01:00
|
|
|
@enumerate
|
|
|
|
@item
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Allow gathering all the configuration details of a package into one
|
|
|
|
place, making it easier to copy, disable, or move it elsewhere in the
|
|
|
|
init file.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@item
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Reduce duplication and repetitive boilerplate, capturing several
|
|
|
|
common practices as mere keywords both easy and intuitive to use.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@item
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Make startup time of Emacs as short as possible, without sacrificing
|
|
|
|
the quantity of add-on packages used.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@item
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Ensure that errors encountered during startup disable only the
|
|
|
|
package(s) raising the error(s), and as little else as possible,
|
|
|
|
leaving Emacs as close to fully functional as possible.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@item
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Allow byte-compiling your init file, so that any warnings or errors
|
|
|
|
you see at startup are meaningful. In this way, even if
|
|
|
|
byte-compilation is not used for speed (see item 3 above), it can
|
|
|
|
still be used as a sanity check.
|
2022-12-08 00:47:04 +01:00
|
|
|
@end enumerate
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
It is worth noting that use-package is not intended to replace the
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
standard customization command @w{@kbd{M-x customize}} (@pxref{Easy
|
|
|
|
Customization,,, emacs, GNU Emacs Manual}). On the contrary, it is
|
|
|
|
designed to work together with it, for things that Customize cannot
|
|
|
|
do.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@c ----------------------------------------------------------------------------
|
|
|
|
@node Getting Started
|
|
|
|
@chapter Getting Started
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex quick-start instructions
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
This chapter provides instructions and examples for quickly getting
|
2022-12-27 15:40:43 +01:00
|
|
|
started with use-package. In this manual, we say that each call to
|
|
|
|
the @code{use-package} macro in your init file is a @dfn{declaration},
|
|
|
|
to highlight the declarative nature of its syntax.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
To unconditionally load a package named @samp{foo}, add the following
|
|
|
|
declaration to your init file:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
|
|
|
(use-package foo)
|
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@noindent
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
This declaration is equivalent to using @code{require} (@pxref{Named
|
|
|
|
Features,,, elisp, GNU Emacs Lisp Reference Manual}), with some
|
|
|
|
use-package specific error handling added in. Just like
|
|
|
|
@code{require}, it needs the package @samp{foo} to be installed and
|
|
|
|
available via your @code{load-path} (@pxref{Installing packages}).
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
To evaluate some Lisp @emph{before} the @samp{foo} package is loaded,
|
2022-12-08 00:47:04 +01:00
|
|
|
use the @code{:init} keyword:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:init
|
|
|
|
(setq foo-variable t))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
Similarly, @code{:config} can be used to execute code @emph{after} a
|
|
|
|
package is loaded. In cases where loading is done lazily
|
|
|
|
(@pxref{Loading Packages}), this execution is deferred until after the
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
loading actually occurs. As you might expect, you can use
|
|
|
|
@code{:init} and @code{:config} together:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:init
|
|
|
|
(setq foo-variable t)
|
|
|
|
:config
|
|
|
|
(foo-mode 1))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2024-07-23 23:32:56 +02:00
|
|
|
The above declarations will load the @samp{foo} package immediately. In
|
|
|
|
most cases, this is not necessary or desirable, as that will slow down
|
|
|
|
Emacs startup. Instead, you should try to set things up so that
|
2024-07-24 14:01:01 +03:00
|
|
|
packages are only loaded when they are actually needed (this is known as
|
|
|
|
``autoloading''). If you have installed a package from @acronym{GNU}
|
2024-07-23 23:32:56 +02:00
|
|
|
@acronym{ELPA} that provides its own autoloads, it is often enough to
|
|
|
|
say:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:defer t)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@noindent
|
|
|
|
This will avoid loading the package. Now, when you run any autoloaded
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
command, the package @samp{foo} is loaded automatically. (Which
|
|
|
|
commands from a package are marked to auto-load by default is the
|
|
|
|
decision of the package authors.)
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
In some cases, you might need or want to provide your own autoloads.
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
The more complex example below autoloads the commands
|
|
|
|
@code{isearch-moccur} and @code{isearch-all} from the package
|
2022-12-08 00:47:04 +01:00
|
|
|
@file{color-moccur.el}, and binds keys both globally and in
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@code{isearch-mode-map}. When one of these two commands are used, the
|
|
|
|
package will be loaded. At that point, @code{moccur-edit} is also loaded,
|
2022-12-08 00:47:04 +01:00
|
|
|
to allow editing of the @code{moccur} buffer.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package color-moccur
|
|
|
|
:commands (isearch-moccur isearch-all)
|
|
|
|
:bind (("M-s O" . moccur)
|
|
|
|
:map isearch-mode-map
|
|
|
|
("M-o" . isearch-moccur)
|
|
|
|
("M-O" . isearch-moccur-all))
|
|
|
|
:init
|
|
|
|
(setq isearch-lazy-highlight t)
|
|
|
|
:config
|
|
|
|
(use-package moccur-edit))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
Some packages will suggest ready-made @code{use-package} declarations
|
|
|
|
that you can use. Where possible, it is a good idea to copy them, and
|
|
|
|
use that as a starting point.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
That should be enough to get you started!
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@c ----------------------------------------------------------------------------
|
|
|
|
@node Loading Packages
|
|
|
|
@chapter Loading Packages
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex loading packages with use-package
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
Before use-package can load an Emacs Lisp package, it must be
|
|
|
|
available in a directory on your @code{load-path}. When you install
|
|
|
|
packages using the built-in @code{install-package} command, it will do
|
|
|
|
this automatically for you. Packages shipped with Emacs (built-in
|
|
|
|
packages) are always available.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
Some packages have more than one library. In those cases, you might
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
need more than one @code{use-package} declaration to make sure the
|
|
|
|
package is properly loaded. For complex configurations, you might
|
|
|
|
also need more than one declaration for a package with the same name.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
use-package can interface with @samp{package.el} to install packages
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
on Emacs start. @xref{Installing packages}, for details.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@menu
|
|
|
|
* Loading basics:: How and when packages are loaded.
|
|
|
|
* Deferring loading:: Loading packages later.
|
|
|
|
* Forcing loading:: Loading packages immediately.
|
|
|
|
* Conditional loading:: Loading packages conditionally.
|
|
|
|
* Loading sequentially:: Loading packages in sequence.
|
2024-07-23 15:12:01 +02:00
|
|
|
* The @code{emacs} package:: Customizing built-in variables.
|
2022-12-08 00:47:04 +01:00
|
|
|
* Load dependencies:: Don't load without dependencies.
|
2022-12-12 08:45:40 +01:00
|
|
|
* Manual installation:: Loading manually installed packages.
|
2022-12-08 00:47:04 +01:00
|
|
|
@end menu
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Loading basics
|
|
|
|
@section How and when use-package loads packages
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
The call to the @code{use-package} macro will load a package either
|
|
|
|
immediately, or when the package is first used (via autoloading). In the
|
2022-12-08 00:47:04 +01:00
|
|
|
simplest case, a @code{use-package} declaration loads a package when
|
|
|
|
it is evaluated.@footnote{This happens both at run-time and at
|
|
|
|
compile-time. @xref{Byte-compiling}.} If the declaration is in your
|
|
|
|
init file, this happens automatically each time Emacs is started.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
For example, the declaration below immediately loads the library
|
|
|
|
@code{foo}, just like @code{require} would:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
|
|
|
(use-package foo)
|
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@noindent
|
|
|
|
If the library @samp{foo} is not available in your @code{load-path},
|
|
|
|
the declaration logs a warning to the @samp{*Messages*} buffer.
|
|
|
|
|
|
|
|
@cindex package vs library
|
|
|
|
@c So, confusingly, (use-package foo) actually means to use the
|
|
|
|
@c _library_ foo.el, not all of the _package_ foo's libraries?
|
|
|
|
@c Should this be explicitly explained here?
|
2022-12-08 00:47:04 +01:00
|
|
|
Note that a ``package'' is different from an Emacs Lisp ``library''.
|
|
|
|
The above declaration tells use-package to load the @emph{library}
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@file{foo.el}, which in the overwhelming majority of cases also
|
|
|
|
resides in a @emph{package} named @code{foo}. But the package
|
|
|
|
@code{foo} might also contain a library named @file{foo-extra.el}. If
|
|
|
|
that library is not loaded automatically, you will need a separate
|
|
|
|
@code{use-package} declaration to make sure that it is loaded when
|
|
|
|
needed. This manual will often use the terms ``package'' and
|
|
|
|
``library'' interchangeably, as this distinction does not usually
|
|
|
|
matter, but you should keep it in mind for the cases when it does.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
The details of how and when you should load a package might differ
|
|
|
|
from one package to another. When in doubt, refer to the package
|
|
|
|
documentation for details.
|
|
|
|
|
|
|
|
@node Deferring loading
|
|
|
|
@section Deferring package loading
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex deferring loading of package
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@cindex autoloading packages
|
|
|
|
@cindex loading lazily
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex lazy loading of packages
|
2022-12-08 00:47:04 +01:00
|
|
|
In the examples we have seen so far, use-package loads packages every
|
|
|
|
time you start Emacs, even if that package is never used. That will
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
make starting Emacs slower. use-package therefore allows setting
|
|
|
|
things up in such a way that packages are only loaded when some of the
|
|
|
|
package's commands is first used (either with @kbd{M-x} or via some key
|
|
|
|
binding). This is based on autoloading, a full description of which
|
|
|
|
is outside the scope of this manual. @xref{Autoload,,, elisp, GNU
|
|
|
|
Emacs Lisp Reference Manual}, for the full story.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@cindex triggers, for loading packages
|
|
|
|
Some @code{use-package} keywords provide autoload @dfn{triggers} that
|
|
|
|
cause a package to be loaded when certain events occur. For example,
|
|
|
|
the @code{:hook} keyword sets up a trigger that fires when the
|
|
|
|
specified hook is run, and then loads the package automatically. The
|
|
|
|
other trigger keywords, all of which are described later in this
|
|
|
|
manual, are @code{:commands}, @code{:bind}, @code{:bind*},
|
|
|
|
@code{:bind-keymap}, @code{:bind-keymap*}, @code{:mode}, and
|
|
|
|
@code{:interpreter}.
|
|
|
|
|
|
|
|
@subheading The @code{:defer} keyword
|
|
|
|
|
|
|
|
@findex :defer
|
|
|
|
If you did not specify any autoloading keyword, use-package will fall
|
|
|
|
back to loading the package immediately (typically when Emacs is
|
|
|
|
starting up). This can be overridden using the @code{:defer} keyword.
|
|
|
|
It takes one boolean argument: a non-@code{nil} value means to stop
|
|
|
|
this package from being immediately loaded. Here is an example of
|
|
|
|
using @code{:defer} to postpone loading the package @samp{foo}:
|
2022-04-04 21:10:44 +02:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:defer t)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2022-04-04 21:10:44 +02:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
Using @code{:defer t} by itself like this is rarely useful.
|
|
|
|
Typically, you would only use it together with a keyword like
|
|
|
|
@code{:config} (@pxref{Lisp Configuration}), or @code{:ensure}
|
|
|
|
(@pxref{Installing packages}).
|
2022-04-04 21:10:44 +02:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@subheading Defer loading until idle for N seconds
|
2022-04-04 21:10:44 +02:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@findex :defer@r{, with a numeric argument}
|
|
|
|
You can also give a numeric argument @var{n} to @w{@code{:defer}} to
|
2022-12-08 00:47:04 +01:00
|
|
|
specify that a package should be loaded (if it hasn't already) after
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Emacs has been idle for @var{n} seconds. For example, use the
|
|
|
|
following to make use-package load @samp{foo} after 30 seconds of idle
|
|
|
|
time:
|
2022-04-04 21:10:44 +02:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:defer 30)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2022-04-04 21:10:44 +02:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@subheading When to use @code{:defer}
|
|
|
|
|
|
|
|
When using autoloading keywords, there is no need to also use
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@code{:defer}. It doesn't hurt to add it in this case, perhaps for
|
|
|
|
extra clarity, but it is redundant.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
You should use @code{:defer} to force deferred loading, in cases when
|
|
|
|
use-package isn't creating any autoloads for you. For example, you
|
|
|
|
might know that some other package will already do something to cause
|
|
|
|
your package to load at the appropriate time. This is usually the
|
|
|
|
case when you install a package using @code{package-install}, as
|
|
|
|
packages installed in this way normally always have their own
|
|
|
|
autoloads already set up.
|
|
|
|
|
|
|
|
@subheading Making @w{@code{:defer t}} the default
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex defer loading by default
|
|
|
|
@cindex lazy loading by default
|
2022-12-08 00:47:04 +01:00
|
|
|
@vindex use-package-always-defer
|
|
|
|
If you customize the user option @code{use-package-always-defer} to
|
|
|
|
non-@code{nil}, the @code{use-package} macro will behave as if
|
|
|
|
@w{@code{:defer t}} is always specified. This can be overridden for
|
|
|
|
individual declarations using either @w{@code{:defer nil}} or
|
|
|
|
@w{@code{:demand t}} (@pxref{Forcing loading}).
|
|
|
|
|
|
|
|
@node Forcing loading
|
|
|
|
@section Forcing package to load immediately
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex forcing immediate loading
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@findex :demand
|
|
|
|
The presence of autoloading trigger keywords can be overridden using
|
|
|
|
@code{:demand t}, which forces the package to load immediately. Thus,
|
|
|
|
even if you use an autoloading keyword such as @code{:bind}
|
|
|
|
(@pxref{Key bindings}), adding @code{:demand} will force loading to
|
|
|
|
occur immediately. It will also avoid creating an autoload for the
|
|
|
|
bound key, as it would be redundant.
|
|
|
|
|
|
|
|
If you specify both @w{@code{:demand t}} and @w{@code{:defer t}}, the
|
|
|
|
@code{:defer} keyword will take precedence.
|
|
|
|
|
|
|
|
@node Conditional loading
|
|
|
|
@section Loading packages conditionally
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex conditional loading
|
|
|
|
@cindex loading conditions
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@findex :if
|
|
|
|
@findex :when
|
|
|
|
@findex :unless
|
|
|
|
The @code{:if}, @code{:when}, and @code{:unless} keywords predicates
|
|
|
|
the loading and initialization of packages. They all accept one
|
|
|
|
argument, an Emacs Lisp form that is evaluated at run-time.
|
|
|
|
|
|
|
|
If the argument of the @code{:if} keyword evaluates to non-@code{nil},
|
|
|
|
the package will be loaded and initialized. The @code{:when} keyword
|
|
|
|
is provided as an alias for @code{:if}. Finally, the @code{:unless}
|
|
|
|
keyword is the inverse of @code{:if}, such that @w{@code{:unless foo}}
|
|
|
|
means the same thing as @w{@code{:if (not foo)}}.
|
|
|
|
|
2022-12-09 04:15:32 +01:00
|
|
|
For example, if you only want to load @samp{foo} in graphical Emacs
|
|
|
|
sessions, you could use the following:
|
2022-04-04 21:10:44 +02:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:if (display-graphic-p))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2022-04-04 21:10:44 +02:00
|
|
|
|
2022-12-09 04:15:32 +01:00
|
|
|
@subheading Some common use cases
|
|
|
|
|
|
|
|
Here are some common cases for conditional loading, and how to achieve
|
|
|
|
them.
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@c FIXME: Too many redundant examples? E.g., why do we need both an
|
|
|
|
@c example for system-type and window-system? or both of the last 2
|
|
|
|
@c examples?
|
2022-12-09 04:15:32 +01:00
|
|
|
@itemize
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@item
|
|
|
|
Operating system
|
2022-12-09 04:15:32 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
The following example loads a package only on GNU/Linux. See the
|
|
|
|
docstring of @code{system-type} for other valid values.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
2022-12-09 04:15:32 +01:00
|
|
|
:if (eq system-type 'gnu/linux)
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@item
|
|
|
|
Window system
|
2022-12-09 04:15:32 +01:00
|
|
|
|
2023-10-22 07:54:50 +00:00
|
|
|
The example below loads a package only on macOS and X@. See the
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
docstring of @code{window-system} for valid values.
|
2022-12-09 04:15:32 +01:00
|
|
|
|
|
|
|
@lisp
|
|
|
|
:if (memq window-system '(ns x))
|
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@item
|
|
|
|
Installed package
|
2022-12-09 04:15:32 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
The following example loads a package only when the @samp{foo} package
|
|
|
|
is installed.
|
2022-12-09 04:15:32 +01:00
|
|
|
|
|
|
|
@lisp
|
|
|
|
:if (package-installed-p 'foo)
|
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@item
|
|
|
|
Libraries in @code{load-path}
|
2022-12-09 04:15:32 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
The example below loads a package only when @file{foo.el} is available
|
|
|
|
in your @code{load-path} (for example, if you installed that file
|
2022-12-09 04:15:32 +01:00
|
|
|
manually):
|
|
|
|
|
|
|
|
@lisp
|
|
|
|
:if (locate-library "foo.el")
|
|
|
|
@end lisp
|
|
|
|
@end itemize
|
|
|
|
|
|
|
|
@subheading Making conditional loading affect @code{:preface} and @code{:ensure}
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@cindex conditional loading before @code{:preface} or @code{:ensure}
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
If you need to make a use-package form conditional so that the condition
|
|
|
|
occurs before even @code{:ensure} (@pxref{Install package}) or
|
|
|
|
@code{:preface} (@pxref{Preface keyword}), use @code{when}
|
|
|
|
around the @code{use-package} form itself. For example:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(when (memq window-system '(mac ns))
|
|
|
|
(use-package foo
|
|
|
|
:ensure t))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Loading sequentially
|
|
|
|
@section Loading packages in sequence
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex loading a package after other packages
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@findex :after
|
|
|
|
Sometimes it only makes sense to configure a package after another one
|
|
|
|
has been loaded, because certain variables or functions are not in
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
scope until that time. This can be achieved with the @code{:after}
|
2022-12-08 00:47:04 +01:00
|
|
|
keyword, which allows a fairly rich description of the exact
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
conditions when loading should occur. The @code{:after} keyword takes
|
|
|
|
as argument either a symbol indicating the package name, a list of
|
|
|
|
such symbols, or a list of selectors (see below).
|
2022-12-08 00:47:04 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Here is an example of using the @acronym{GNU} @acronym{ELPA} packages
|
|
|
|
@file{hydra}, @file{ivy}, and @file{ivy-hydra}. Note that
|
|
|
|
@file{ivy-hydra} will always be loaded last:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package hydra)
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package ivy)
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
(use-package ivy-hydra
|
|
|
|
:after (ivy hydra))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
In this case, because the declarations are evaluated in the order they
|
|
|
|
occur, the use of @code{:after} is not strictly necessary. However,
|
|
|
|
if @samp{hydra} and @samp{ivy} were to be autoloaded, using
|
|
|
|
@code{:after} guarantees that @samp{ivy-hydra} is not loaded until it
|
|
|
|
is actually needed. By using @code{:after}, the above code will also
|
|
|
|
work even if the order of the declaration changes. This means that
|
|
|
|
moving things around in your init file is less likely to break things.
|
|
|
|
|
|
|
|
@subheading Using @code{:after} selectors
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@findex :all@r{, (with @code{:after})}
|
|
|
|
@findex :any@r{, (with @code{:after})}
|
|
|
|
@cindex list of selectors, for @code{:after}
|
2022-12-08 00:47:04 +01:00
|
|
|
The @code{:after} keyword also accepts a list of selectors. By
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
default, @w{@code{:after (foo bar)}} is the same as @w{@code{:after
|
|
|
|
(:all foo bar)}}, meaning that loading of the given package will not happen
|
2022-12-08 00:47:04 +01:00
|
|
|
until both @code{foo} and @code{bar} have been loaded. Here are some
|
|
|
|
of the other possibilities:
|
|
|
|
|
|
|
|
@verbatim
|
2017-12-04 12:11:59 -08:00
|
|
|
:after (foo bar)
|
|
|
|
:after (:all foo bar)
|
|
|
|
:after (:any foo bar)
|
|
|
|
:after (:all (:any foo bar) (:any baz quux))
|
|
|
|
:after (:any (:all foo bar) (:all baz quux))
|
2022-12-08 00:47:04 +01:00
|
|
|
@end verbatim
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
When you nest selectors, such as in @w{@code{(:any (:all foo bar)
|
|
|
|
(:all baz quux))}}, it means that the package will be loaded when
|
|
|
|
either both @code{foo} and @code{bar} have been loaded, or when both
|
|
|
|
@code{baz} and @code{quux} have been loaded.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex @code{use-package-always-defer}, with @code{:after}
|
2022-12-08 00:47:04 +01:00
|
|
|
Pay attention when setting @code{use-package-always-defer} to a
|
|
|
|
non-@code{nil} value, and also using the @code{:after} keyword. In
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
that case, you will need to specify how the declared package is to be
|
|
|
|
loaded: for example, by some @code{:bind} (@pxref{Global
|
|
|
|
keybindings}). If you are not using one of the keywords that
|
|
|
|
registers autoloads, such as @code{:bind} or @code{:hook}
|
|
|
|
(@pxref{Hooks}), and your package manager does not provide autoloads,
|
|
|
|
it is possible that your package will never be loaded if you do not
|
|
|
|
add @code{:demand t} to those declarations.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
2024-07-23 15:12:01 +02:00
|
|
|
@node The @code{emacs} package
|
|
|
|
@section Customizing built-in variables
|
|
|
|
@cindex customizing built-in variables
|
|
|
|
|
|
|
|
Some users want to put all their customizations in use-package
|
|
|
|
declarations, even for variables, hooks, and options that are always
|
|
|
|
available, without loading any package.@footnote{In other words, they
|
2024-07-25 03:35:04 +02:00
|
|
|
are either preloaded in Emacs or defined in Emacs's C sources.}
|
2024-07-23 15:12:01 +02:00
|
|
|
|
|
|
|
For that purpose, you can use the no-op @samp{emacs} package:
|
|
|
|
|
|
|
|
@lisp
|
|
|
|
@group
|
|
|
|
(use-package emacs
|
|
|
|
:init
|
|
|
|
(setq custom-file "~/.emacs.d/emacs-custom.el")
|
|
|
|
(load custom-file)
|
|
|
|
(setq frame-title-format "%b")
|
|
|
|
:custom
|
|
|
|
(use-short-answers t))
|
|
|
|
@end group
|
|
|
|
@end lisp
|
|
|
|
|
|
|
|
This declaration takes advantage of the fact that @w{@code{(featurep
|
|
|
|
'emacs)}} always returns true, and has no special meaning beyond that.
|
|
|
|
It simply provides a way to organize your customizations, without
|
|
|
|
loading anything.
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Load dependencies
|
|
|
|
@section Prevent loading if dependencies are missing
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex prevent loading package if dependencies are missing
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@findex :requires
|
|
|
|
While the @code{:after} keyword delays loading until the dependencies
|
|
|
|
are loaded, the somewhat simpler @code{:requires} keyword @emph{never}
|
|
|
|
loads the package if the dependencies are not available when the
|
|
|
|
@code{use-package} declaration is evaluated. In this context,
|
|
|
|
``available'' means that @code{foo} is available if @w{@code{(featurep
|
|
|
|
'foo)}} evaluates to a non-@code{nil} value. For example:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package abbrev
|
|
|
|
:requires foo)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@noindent
|
2022-12-08 00:47:04 +01:00
|
|
|
This is the same as:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package abbrev
|
|
|
|
:if (featurep 'foo))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2022-04-04 21:10:44 +02:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
As a convenience, a list of such packages may be specified:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package abbrev
|
|
|
|
:requires (foo bar baz))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
|
|
|
For more complex logic, such as that supported by @code{:after},
|
|
|
|
simply use @code{:if} and the appropriate Lisp expression.
|
|
|
|
|
2022-12-12 08:45:40 +01:00
|
|
|
@node Manual installation
|
|
|
|
@section Manually installed package
|
|
|
|
|
2024-07-25 03:35:04 +02:00
|
|
|
When installing packages manually, without Emacs's built-in package
|
2022-12-12 08:45:40 +01:00
|
|
|
manager (@file{package.el}), it will obviously not help you set up
|
|
|
|
autoloads or add it to your @code{load-path}. You must do it
|
|
|
|
yourself. However, use-package makes this more convenient.
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* Load path:: Using a custom @code{load-path}.
|
|
|
|
* Manual autoloads:: Setting up autoloads manually.
|
|
|
|
@end menu
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Load path
|
2022-12-12 08:45:40 +01:00
|
|
|
@subsection Setting a custom @code{load-path}
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex custom @code{load-path} for loading a package
|
|
|
|
@cindex @code{load-path}, add directories for loading a package
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-12 08:45:40 +01:00
|
|
|
When installing packages manually, you must make sure its libraries
|
|
|
|
are available on your @code{load-path}. @xref{Lisp Libraries,,,
|
|
|
|
emacs, GNU Emacs Manual}, for more details about package loading.
|
|
|
|
|
2022-12-08 01:49:04 +01:00
|
|
|
@findex :load-path
|
2022-12-12 08:45:40 +01:00
|
|
|
The @code{:load-path} keyword provides a convenient way to add
|
|
|
|
directories to your load path. It takes as argument a symbol, a
|
|
|
|
function, a string or a list of strings. If a directory is specified
|
|
|
|
as a relative file name, it is expanded relative to
|
|
|
|
@code{user-emacs-directory}.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-12 08:45:40 +01:00
|
|
|
(use-package org
|
|
|
|
:load-path "site-lisp/org/lisp/"
|
|
|
|
:commands org-mode)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-12 08:45:40 +01:00
|
|
|
When using a symbol or a function to provide a dynamically generated
|
|
|
|
list of directories, you must inform the byte-compiler of this
|
|
|
|
definition, so that the value is available at byte-compilation time.
|
2022-12-08 00:47:04 +01:00
|
|
|
This is done by using the special form @code{eval-and-compile} (as
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
opposed to @code{eval-when-compile}, @pxref{Eval During Compile,,,
|
2022-12-12 08:45:40 +01:00
|
|
|
elisp, GNU Emacs Lisp Reference Manual}). Furthermore, this value is
|
|
|
|
fixed to the value it had during compilation. If the operation is
|
|
|
|
costly, you do not have to repeat it again on each startup. For
|
|
|
|
example:
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(eval-and-compile
|
|
|
|
(defun ess-site-load-path ()
|
2022-12-10 12:59:30 +01:00
|
|
|
(shell-command-to-string "find ~ -path ess/lisp")))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package ess-site
|
|
|
|
:load-path (lambda () (list (ess-site-load-path)))
|
|
|
|
:commands R)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Manual autoloads
|
2022-12-12 08:45:40 +01:00
|
|
|
@subsection Setting up autoloads manually
|
|
|
|
|
|
|
|
Packages often document how to set up its autoloads when it is being
|
|
|
|
manually installed. If it does, follow those instructions.
|
|
|
|
Otherwise, you might want to set them up manually.
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex autoloads for packages, setting up manually
|
|
|
|
@cindex package autoloads, setting up manually
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@findex :commands
|
|
|
|
@findex :autoload
|
2022-12-12 08:45:40 +01:00
|
|
|
To autoload an interactive command, use the @code{:commands} keyword,
|
|
|
|
which takes either a symbol or a list of symbols as its argument. It
|
|
|
|
creates autoloads for those commands (which defers loading of the
|
|
|
|
module until those commands are used).
|
|
|
|
|
|
|
|
The @code{:autoload} keyword takes the same arguments as
|
|
|
|
@code{:commands}, but is used to autoload non-interactive functions.
|
|
|
|
Here is an example:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package org-crypt
|
|
|
|
:autoload org-crypt-use-before-save-magic)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@c ----------------------------------------------------------------------------
|
|
|
|
@node Configuring Packages
|
|
|
|
@chapter Configuring Packages
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex configure packages using @code{use-package}
|
|
|
|
@cindex customize package configuration
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
This chapter describes the various keywords provided by
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@code{use-package} that help you configure packages.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@menu
|
|
|
|
* Lisp Configuration:: Using Lisp to configure packages.
|
|
|
|
* Key bindings:: Making your own keybindings.
|
|
|
|
* Hooks:: Adding functions to hooks.
|
|
|
|
* Modes and interpreters:: Enabling modes automatically.
|
|
|
|
* Magic handlers:: Using regexps to enable modes.
|
|
|
|
* User options:: Setting user options.
|
|
|
|
* Faces:: Customizing faces.
|
|
|
|
* Hiding minor modes:: Tidying up the mode line.
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
@node Lisp Configuration
|
|
|
|
@section Using Lisp code for configuring packages
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex configure package using Lisp forms
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
The most general way to add customizations are the @code{:preface},
|
|
|
|
@code{:init}, and @code{:config} keywords. They all accept one or
|
|
|
|
more Emacs Lisp forms, up to the next keyword, that are evaluated in
|
|
|
|
order. This lets you add arbitrary Lisp code to your
|
|
|
|
@code{use-package} declarations.
|
|
|
|
|
|
|
|
The only difference between these keywords is when they are evaluated.
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* Preface keyword:: Evaluate code before anything else.
|
|
|
|
* Init keyword:: Evaluate code before loading package.
|
|
|
|
* Config keyword:: Evaluate code after loading package.
|
|
|
|
* Best practices:: When to use @code{:config}, @code{:init}, and @code{:preface}.
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
@node Preface keyword
|
|
|
|
@subsection @code{:preface} is evaluated first
|
|
|
|
|
|
|
|
@findex :preface
|
|
|
|
The @code{:preface} section is evaluated before anything else, except
|
|
|
|
@code{:disabled} and @code{:ensure}. It can be used to establish
|
|
|
|
function and variable definitions that will:
|
|
|
|
|
|
|
|
@enumerate
|
|
|
|
@item
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Make the byte-compiler happy: it will not complain about functions
|
2022-12-10 12:59:30 +01:00
|
|
|
whose definitions are unknown.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@item
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Define functions and variables that will be used in an @code{:if}
|
|
|
|
test.
|
2022-12-08 00:47:04 +01:00
|
|
|
@end enumerate
|
|
|
|
|
|
|
|
Note that whatever is specified within @code{:preface} is evaluated
|
|
|
|
both at load time and at byte-compilation time, in order to ensure
|
|
|
|
that definitions are seen by both the Lisp evaluator and the
|
|
|
|
byte-compiler. Therefore, you should avoid having any side-effects in
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
your @code{:preface} forms, and restrict them to symbol declarations
|
|
|
|
and definitions.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@node Init keyword
|
|
|
|
@subsection @code{:init} is evaluated before loading package
|
|
|
|
|
|
|
|
@findex :init
|
|
|
|
The @code{:init} section is evaluated just before the package is
|
|
|
|
loaded. Note that the @code{:init} form is run unconditionally --
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
even if the package happens to not exist on your system. You must
|
|
|
|
therefore remember to restrict @code{:init} code to what would succeed
|
|
|
|
either way; put the rest in the @code{:config} section. @code{:init}
|
|
|
|
also always happens before package load, whether @code{:config} has
|
|
|
|
been deferred or not.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@node Config keyword
|
|
|
|
@subsection @code{:config} is evaluated after loading package
|
|
|
|
|
|
|
|
@findex :config
|
|
|
|
The @code{:config} section is evaluated after the package has been
|
|
|
|
loaded. If the package is loaded immediately, this happens
|
|
|
|
immediately after that, but if loading is done lazily (@pxref{Loading
|
|
|
|
Packages}), this is deferred until after the package has been loaded.
|
|
|
|
|
|
|
|
In general, you should keep @code{:init} forms as simple and quick as
|
|
|
|
possible, and put as much as you can get away with into the
|
|
|
|
@code{:config} section. That way, deferred loading can help your
|
|
|
|
Emacs start as quickly as possible.
|
|
|
|
|
|
|
|
@node Best practices
|
2023-06-15 12:23:29 +02:00
|
|
|
@subsection When to use @code{:preface}, @code{:config} and @code{:init}?
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex tips for using @code{:preface}, @code{:config}, @code{:init}
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
Where possible, it is better to avoid @code{:preface}, @code{:config}
|
|
|
|
and @code{:init}. Instead, prefer autoloading keywords such as
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@code{:bind} (@pxref{Key bindings}), @code{:hook} (@pxref{Hooks}), and
|
|
|
|
@code{:mode} (@pxref{Modes and interpreters}), as they will take care
|
2022-12-08 00:47:04 +01:00
|
|
|
of setting up autoloads for you without any need for boilerplate code.
|
|
|
|
For example, consider the following declaration:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
2017-12-04 12:11:59 -08:00
|
|
|
:init
|
2022-12-08 00:47:04 +01:00
|
|
|
(add-hook 'some-hook 'foo-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@noindent
|
2022-12-08 00:47:04 +01:00
|
|
|
This has two problems. First, it will unconditionally load the
|
|
|
|
package @samp{foo} on startup, which will make things slower. You can
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
fix this by adding @w{@code{:defer t}}:
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(add-hook 'some-hook 'foo-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@noindent
|
2022-12-08 00:47:04 +01:00
|
|
|
This is better, as @samp{foo} is now only loaded when it is actually
|
|
|
|
needed (that is, when the hook @samp{some-hook} is run).
|
|
|
|
|
|
|
|
The second problem is that there is a lot of boilerplate that you have
|
|
|
|
to write. In this case, it might not be so bad, but avoiding that was
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
what use-package was made to allow. The better option in this case is
|
|
|
|
therefore to use @code{:hook} (@pxref{Hooks}), which also implies
|
2022-12-08 00:47:04 +01:00
|
|
|
@w{@code{:defer t}}. The above is thereby reduced down to:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:hook some-hook)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Now use-package will set up autoloading for you, and your Emacs
|
|
|
|
startup time will not suffer one bit.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@node Key bindings
|
|
|
|
@section Key bindings
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex binding keys for package commands
|
|
|
|
@cindex key bindings for package commands
|
|
|
|
One common thing to do when loading a package is to bind keys to
|
2022-12-08 00:47:04 +01:00
|
|
|
commands within that module. Without use-package, this would be done
|
|
|
|
using a combination of @code{keymap-local-set},
|
|
|
|
@code{keymap-global-set} and various autoloads. With use-package, you
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
can simplify this using the @code{:bind} keyword, as described in this
|
|
|
|
section.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@menu
|
|
|
|
* Global keybindings:: Bindings you can use anywhere.
|
|
|
|
* Binding in keymaps:: Bindings for particular modes.
|
|
|
|
* Binding to a keymap:: Binding a key to a keymap.
|
|
|
|
* Binding to repeat-maps:: Binding repeating keys.
|
|
|
|
* Displaying keybindings:: Displaying personal key bindings.
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
@node Global keybindings
|
|
|
|
@subsection Global keybindings
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex global keybindings
|
2022-12-08 00:47:04 +01:00
|
|
|
|
2022-12-08 01:49:04 +01:00
|
|
|
@findex :bind
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
To bind keys globally, the @code{:bind} keyword takes as its argument
|
|
|
|
either a single cons or a list of conses. Each cons has the form
|
|
|
|
@w{@code{(@var{key} . @var{command})}}, where @var{key} is a string
|
|
|
|
indicating the key to bind, and @var{command} is the name of a command
|
|
|
|
(a symbol). The syntax for the keys is similar to the syntax used by
|
|
|
|
the @code{kbd} function (see @ref{Init Rebinding,,, emacs, GNU Emacs
|
|
|
|
Manual}, for more information).
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@subheading Using @code{:bind} with a single cons
|
|
|
|
|
|
|
|
Here is an example of using a single cons:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package ace-jump-mode
|
|
|
|
:bind ("C-." . ace-jump-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@noindent
|
2022-12-08 00:47:04 +01:00
|
|
|
This does two things: first, it creates an autoload for the
|
|
|
|
@code{ace-jump-mode} command and defers loading of the
|
|
|
|
@code{ace-jump-mode} package until you actually use it. Second, it
|
|
|
|
binds the key @code{C-.} to that command globally.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@subheading Using @code{:bind} with a list of conses
|
|
|
|
|
|
|
|
Here is an example of using @code{:bind} with a list of conses:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
(use-package hi-lock
|
|
|
|
:bind (("M-o l" . highlight-lines-matching-regexp)
|
2022-04-04 21:10:44 +02:00
|
|
|
("M-o r" . highlight-regexp)
|
|
|
|
("M-o w" . highlight-phrase)))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@noindent
|
|
|
|
This binds the three key sequences to the corresponding commands.
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@subheading Using special keys
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex binding function keys with @code{:bind}
|
|
|
|
@cindex @code{:bind}, and function keys
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@c FIXME: TAB vs [tab] -- is letter-case important? In general, these
|
|
|
|
@c are two different keys: one is an ASCII character, the other a
|
|
|
|
@c function key on GUI frames.
|
2022-12-08 00:47:04 +01:00
|
|
|
Inside key strings, special keys like @kbd{TAB} or @kbd{F1}--@kbd{F12}
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
have to be written inside angle brackets, e.g., @code{"C-<up>"}.
|
|
|
|
@c FIXME: ``Some combinations''? which ones?
|
2022-12-08 00:47:04 +01:00
|
|
|
Standalone special keys (and some combinations) can be written in
|
|
|
|
square brackets, e.g.@ @code{[tab]} instead of @code{"<tab>"}.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
(use-package helm
|
|
|
|
:bind (("M-x" . helm-M-x)
|
2022-04-04 21:10:44 +02:00
|
|
|
("M-<f5>" . helm-find-files)
|
|
|
|
([f10] . helm-buffers-list)
|
|
|
|
([S-f10] . helm-recentf)))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@subheading Remapping commands
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex remapping commands with @code{:bind}
|
|
|
|
@cindex @code{:bind}, and remapping of commands
|
2022-12-08 00:47:04 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Remapping of commands with @code{:bind} and @code{bind-key} works as
|
2022-12-08 00:47:04 +01:00
|
|
|
expected, because when the binding is a vector, it is passed straight
|
|
|
|
to @code{define-key}. @xref{Remapping Commands,,, elisp, GNU Emacs
|
2023-10-26 19:46:32 +08:00
|
|
|
Lisp Reference Manual}, for more information about command remapping.
|
2022-12-08 00:47:04 +01:00
|
|
|
For example, the following declaration will rebind
|
|
|
|
@code{fill-paragraph} (bound to @kbd{M-q} by default) to
|
|
|
|
@code{unfill-toggle}:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package unfill
|
|
|
|
:bind ([remap fill-paragraph] . unfill-toggle))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@c FIXME: Should the below be an Appendix?
|
2022-12-08 00:47:04 +01:00
|
|
|
@subheading What @code{:bind} does behind the scenes
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex @code{:bind}, internals
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
To understand what @code{:bind} does behind the scenes, it might be
|
|
|
|
useful to consider an example:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package ace-jump-mode
|
|
|
|
:bind ("C-." . ace-jump-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@noindent
|
2022-12-08 00:47:04 +01:00
|
|
|
This could be expressed in a much more verbose way with the
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@code{:commands} and @code{:init} keywords:
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package ace-jump-mode
|
|
|
|
:commands ace-jump-mode
|
|
|
|
:init
|
|
|
|
(bind-key "C-." 'ace-jump-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@noindent
|
2022-12-08 00:47:04 +01:00
|
|
|
Without using even the @code{:commands} keyword, we could also write
|
|
|
|
the above like so:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package ace-jump-mode
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(autoload 'ace-jump-mode "ace-jump-mode" nil t)
|
|
|
|
(bind-key "C-." 'ace-jump-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
|
|
|
Although these three forms are all equivalent, the first form is
|
|
|
|
usually the best, as it will save some typing.
|
|
|
|
|
|
|
|
@node Binding in keymaps
|
|
|
|
@subsection Key bindings in local keymaps
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex local keybindings
|
2022-12-08 00:47:04 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@findex :map@r{, inside} :bind
|
2022-12-08 00:47:04 +01:00
|
|
|
Slightly different from binding a key to a keymap, is binding a key
|
|
|
|
@emph{within} a local keymap that only exists after the package is
|
|
|
|
loaded. @code{use-package} supports this with a @code{:map} modifier,
|
|
|
|
taking the local keymap to bind to:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
(use-package helm
|
|
|
|
:bind (:map helm-command-map
|
2022-04-04 21:10:44 +02:00
|
|
|
("C-c h" . helm-execute-persistent-action)))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@noindent
|
|
|
|
The effect of this is to wait until @code{helm} has loaded, and then
|
|
|
|
to bind the key sequence @kbd{C-c h} to
|
2022-12-08 00:47:04 +01:00
|
|
|
@code{helm-execute-persistent-action} within Helm's local keymap,
|
|
|
|
@code{helm-command-map}.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Multiple uses of @code{:map} may be specified. Any binding occurring
|
2022-12-08 00:47:04 +01:00
|
|
|
before the first use of @code{:map} are applied to the global keymap:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
(use-package term
|
|
|
|
:bind (("C-c t" . term)
|
2022-04-04 21:10:44 +02:00
|
|
|
:map term-mode-map
|
|
|
|
("M-p" . term-send-up)
|
|
|
|
("M-n" . term-send-down)
|
|
|
|
:map term-raw-map
|
|
|
|
("M-o" . other-window)
|
|
|
|
("M-p" . term-send-up)
|
|
|
|
("M-n" . term-send-down)))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Binding to a keymap
|
|
|
|
@subsection Binding to keymaps
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex binding keys to keymaps
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@findex :bind-keymap
|
2022-12-08 00:47:04 +01:00
|
|
|
Normally @code{:bind} expects that commands are functions that will be
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
autoloaded from the given package. However, this does not work if one of
|
2022-12-08 00:47:04 +01:00
|
|
|
those commands is actually a keymap, since keymaps are not functions,
|
|
|
|
and cannot be autoloaded using the built-in @code{autoload} function.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
To handle this case, @code{use-package} offers a special, limited
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
variant of @code{:bind} called @code{:bind-keymap}. The only difference
|
2022-12-08 00:47:04 +01:00
|
|
|
is that the ``commands'' bound to by @code{:bind-keymap} must be keymaps
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
defined in the package, rather than interactive functions. This is handled
|
2022-12-08 00:47:04 +01:00
|
|
|
behind the scenes by generating custom code that loads the package
|
|
|
|
containing the keymap, and then re-executes your keypress after the
|
|
|
|
first load, to reinterpret that keypress as a prefix key.
|
|
|
|
|
|
|
|
For example:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:bind-keymap ("C-c p" . foo-command-map))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Binding to repeat-maps
|
|
|
|
@subsection Binding to repeat-maps
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex keybinding for @code{repeat-mode} keymaps
|
2022-12-08 00:47:04 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@findex :repeat-map@r{, inside} :bind
|
|
|
|
@cindex @code{repeat-mode} and use-package, using
|
2022-12-08 00:47:04 +01:00
|
|
|
A special case of binding within a local keymap is when that keymap is
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
used by @code{repeat-mode} (@pxref{Repeating,,, emacs, GNU Emacs
|
|
|
|
Manual}). These keymaps are usually defined specifically for
|
2022-12-08 00:47:04 +01:00
|
|
|
this. Using the @code{:repeat-map} keyword, and passing it a name for
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
the map it defines, will bind all the following keys inside that map, and
|
2022-12-08 00:47:04 +01:00
|
|
|
(by default) set the @code{repeat-map} property of each bound command
|
|
|
|
to that map.
|
|
|
|
|
|
|
|
The following example creates a keymap called
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@code{git-gutter+-repeat-map}, makes four bindings in it, then sets
|
|
|
|
the @code{repeat-map} property of each bound command
|
|
|
|
(@code{git-gutter+-next-hunk}, @code{git-gutter+-previous-hunk},
|
|
|
|
@code{git-gutter+-stage-hunks}, and @code{git-gutter+-revert-hunk}) to
|
2022-12-08 00:47:04 +01:00
|
|
|
that keymap.
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package git-gutter+
|
|
|
|
:bind
|
|
|
|
(:repeat-map git-gutter+-repeat-map
|
|
|
|
("n" . git-gutter+-next-hunk)
|
|
|
|
("p" . git-gutter+-previous-hunk)
|
|
|
|
("s" . git-gutter+-stage-hunks)
|
|
|
|
("r" . git-gutter+-revert-hunk)))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@findex :exit@r{, inside} :repeat-map@r{ and} :bind
|
|
|
|
@cindex binding commands used at end of repeat series
|
2022-12-08 00:47:04 +01:00
|
|
|
Specifying @code{:exit} inside the scope of @code{:repeat-map} will
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
prevent the @code{repeat-map} property from being set, so that the command
|
|
|
|
can be used from within the repeat map, but after using it the repeat
|
2022-12-08 00:47:04 +01:00
|
|
|
map will no longer be available. This is useful for commands often used
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
at the end of a series of repeated commands. Example:
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package git-gutter+
|
|
|
|
:bind
|
|
|
|
(:repeat-map my/git-gutter+-repeat-map
|
|
|
|
("n" . git-gutter+-next-hunk)
|
|
|
|
("p" . git-gutter+-previous-hunk)
|
|
|
|
("s" . git-gutter+-stage-hunks)
|
|
|
|
("r" . git-gutter+-revert-hunk)
|
|
|
|
:exit
|
|
|
|
("c" . magit-commit-create)
|
|
|
|
("C" . magit-commit)
|
|
|
|
("b" . magit-blame)))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@findex :continue@r{, inside} :repeat-map@r{ and} :bind
|
2022-12-08 00:47:04 +01:00
|
|
|
Specifying @code{:continue} @emph{forces} setting the
|
|
|
|
@code{repeat-map} property (just like @emph{not} specifying
|
|
|
|
@code{:exit}), so the above snippet is equivalent to:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package git-gutter+
|
|
|
|
:bind
|
|
|
|
(:repeat-map my/git-gutter+-repeat-map
|
|
|
|
:exit
|
|
|
|
("c" . magit-commit-create)
|
|
|
|
("C" . magit-commit)
|
|
|
|
("b" . magit-blame)
|
|
|
|
:continue
|
|
|
|
("n" . git-gutter+-next-hunk)
|
|
|
|
("p" . git-gutter+-previous-hunk)
|
|
|
|
("s" . git-gutter+-stage-hunks)
|
|
|
|
("r" . git-gutter+-revert-hunk)))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Displaying keybindings
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@subsection Displaying personal keybindings
|
|
|
|
@cindex display your keybindings
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@findex describe-personal-keybindings
|
|
|
|
The @code{:bind} keyword uses the @code{bind-keys} macro from the
|
|
|
|
@samp{bind-key.el} library to set up keybindings. It keeps track of
|
|
|
|
all keybindings you make, so that you can display them separately from
|
|
|
|
the default keybindings.
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Use @w{@kbd{M-x describe-personal-keybindings}} to see all
|
2022-12-08 00:47:04 +01:00
|
|
|
keybindings you've set using either the @code{:bind} keyword or the
|
|
|
|
@code{bind-keys} macro.
|
|
|
|
|
|
|
|
@node Hooks
|
|
|
|
@section Hooks
|
|
|
|
|
|
|
|
@cindex hooks
|
2022-12-08 01:49:04 +01:00
|
|
|
@findex :hook
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
The @code{:hook} keyword allows adding functions to hooks. It takes
|
|
|
|
@c FIXME: The actual forms accepted by :hook are different, see below!
|
2022-12-08 00:47:04 +01:00
|
|
|
one argument of the form @var{hooks}, specifying one or more functions
|
|
|
|
to add to one or more hooks. For the purposes of @code{:hook}, the
|
|
|
|
name of hook variables should always exclude the @samp{-hook} suffix.
|
|
|
|
It is appended automatically for you, to save some typing.
|
|
|
|
|
|
|
|
For example, consider the following @code{use-package} declaration
|
|
|
|
that sets up autoloads for @code{company-mode} from the @samp{company}
|
|
|
|
package, and adds @samp{company-mode} to @code{prog-mode-hook}:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package company
|
|
|
|
:commands company-mode
|
2017-12-04 12:11:59 -08:00
|
|
|
:init
|
2022-12-08 00:47:04 +01:00
|
|
|
(add-hook 'prog-mode-hook #'company-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
Using @code{:hook}, this can be simplified to:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package company
|
|
|
|
:hook (prog-mode . company-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
|
|
|
Here, @code{:hook} will automatically set up autoloads for the
|
|
|
|
@code{company-mode} command, so there is no need to use
|
|
|
|
@code{:commands}.
|
|
|
|
|
|
|
|
The @code{:hook} keyword will also assume that the name of the
|
|
|
|
function you want to add is the same as the package name with
|
|
|
|
@samp{-mode} appended to it. Taking this into account, you can
|
|
|
|
simplify the above to the equivalent:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package company
|
|
|
|
:hook prog-mode)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
|
|
|
@cindex multiple hooks
|
|
|
|
You can also provide a list of hooks. When multiple hooks should be
|
|
|
|
applied, the following examples are all equivalent:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package company
|
|
|
|
:hook (prog-mode text-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package company
|
|
|
|
:hook ((prog-mode text-mode) . company-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package company
|
|
|
|
:hook ((prog-mode . company-mode)
|
|
|
|
(text-mode . company-mode)))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package company
|
|
|
|
:commands company-mode
|
2017-12-04 12:11:59 -08:00
|
|
|
:init
|
2022-12-08 00:47:04 +01:00
|
|
|
(add-hook 'prog-mode-hook #'company-mode)
|
|
|
|
(add-hook 'text-mode-hook #'company-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
|
|
|
One common mistake when using @code{:hook} is to forget to omit the
|
|
|
|
@samp{-hook} suffix, which, as already explained, is appended
|
|
|
|
automatically. Therefore, the following will not work, as it attempts
|
|
|
|
to add a function to non-existent @code{prog-mode-hook-hook}:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
;; DOES NOT WORK
|
|
|
|
(use-package ace-jump-mode
|
|
|
|
:hook (prog-mode-hook . ace-jump-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
|
|
|
@vindex use-package-hook-name-suffix
|
|
|
|
If you do not like this behavior, you can customize the user option
|
|
|
|
@code{use-package-hook-name-suffix} to @code{nil}. The value of this
|
|
|
|
variable is @samp{"-hook"} by default.
|
|
|
|
|
|
|
|
The use of @code{:hook}, as with @code{:bind}, @code{:mode},
|
|
|
|
@code{:interpreter}, etc., causes the functions being hooked to
|
|
|
|
implicitly be read as @code{:commands}. This means that they will
|
|
|
|
establish interactive @code{autoload} definitions for that module, if
|
|
|
|
not already defined as functions), and so @code{:defer t} is also
|
|
|
|
implied by @code{:hook}.
|
|
|
|
|
|
|
|
@node Modes and interpreters
|
|
|
|
@section Modes and interpreters
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex @code{auto-mode-alist} customization
|
|
|
|
@cindex @code{interpreter-mode-alist} customization
|
|
|
|
@cindex setting up major modes
|
2022-12-08 00:47:04 +01:00
|
|
|
|
2022-12-08 01:49:04 +01:00
|
|
|
@findex :mode
|
|
|
|
@findex :interpreter
|
2022-12-08 00:47:04 +01:00
|
|
|
Similar to @code{:bind}, you can use @code{:mode} and
|
|
|
|
@code{:interpreter} to establish a deferred binding within the
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@code{auto-mode-alist} and @code{interpreter-mode-alist} variables
|
|
|
|
(@pxref{Auto Major Mode,,, elisp, GNU Emacs Lisp Reference Manual}).
|
2022-12-08 00:47:04 +01:00
|
|
|
The specifier to either keyword can be a cons cell, a list of cons
|
2022-12-08 02:25:53 +01:00
|
|
|
cells, or a string or regexp.
|
|
|
|
|
|
|
|
The following example reproduces the default @code{ruby-mode}
|
|
|
|
configuration, exactly as it is in Emacs out-of-the-box. That mode is
|
|
|
|
enabled automatically when a file whose name matches the regexp
|
2022-12-09 18:21:38 +02:00
|
|
|
@code{"\\.rb\\'"} (a file with the @file{.rb} extension), or when the
|
2022-12-08 02:25:53 +01:00
|
|
|
first line of the file (known as the ``shebang'') matches the string
|
|
|
|
@code{"ruby"}:
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package ruby-mode
|
|
|
|
:mode "\\.rb\\'"
|
|
|
|
:interpreter "ruby")
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 02:25:53 +01:00
|
|
|
@end lisp
|
|
|
|
|
|
|
|
The default @code{python-mode} configuration can be reproduced using
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
the declaration below. Note that the package that should be loaded
|
2022-12-08 02:25:53 +01:00
|
|
|
differs from the mode name in this case, so we must use a cons:
|
2022-12-08 00:47:04 +01:00
|
|
|
|
2022-12-08 02:25:53 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
;; The package is "python" but the mode is "python-mode":
|
|
|
|
(use-package python
|
|
|
|
:mode ("\\.py\\'" . python-mode)
|
|
|
|
:interpreter ("python" . python-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 02:25:53 +01:00
|
|
|
Both the @code{:mode} and @code{:interpreter} keywords also accept a
|
|
|
|
list of regexps:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 02:25:53 +01:00
|
|
|
(use-package foo
|
|
|
|
;; Equivalent to "\\(ba[rz]\\)\\'":
|
|
|
|
:mode ("\\.bar\\'" "\\.baz\\'")
|
|
|
|
;; Equivalent to "\\(foo[ab]\\)":
|
|
|
|
:interpreter ("fooa" "foob"))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 02:25:53 +01:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Magic handlers
|
|
|
|
@section Magic handlers
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex @code{magic-mode-alist} customization
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@findex :magic
|
|
|
|
@findex :magic-fallback
|
|
|
|
Similar to @code{:mode} and @code{:interpreter}, you can also use
|
|
|
|
@code{:magic} and @code{:magic-fallback} to cause certain function to
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
be run if the beginning of a file matches a given regular expression,
|
|
|
|
as if these regular expressions were added to @code{magic-mode-alist}
|
|
|
|
and @code{magic-fallback-mode-alist} (@pxref{Auto Major Mode,,, elisp,
|
|
|
|
GNU Emacs Lisp Reference Manual}). The difference between
|
|
|
|
@code{:magic} and @code{:magic-fallback}, is that the latter has a
|
|
|
|
lower priority than @code{:mode}.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
Here is an example:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package pdf-tools
|
|
|
|
:magic ("%PDF" . pdf-view-mode)
|
2017-12-04 12:11:59 -08:00
|
|
|
:config
|
2022-12-08 00:47:04 +01:00
|
|
|
(pdf-tools-install :no-query))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
This registers an autoloaded command for @code{pdf-view-mode}, defers
|
|
|
|
loading of @code{pdf-tools}, and runs @code{pdf-view-mode} if the
|
|
|
|
beginning of a buffer matches the string @code{"%PDF"}.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node User options
|
|
|
|
@section User options
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex customization of variables
|
|
|
|
@cindex variable customizations
|
|
|
|
@cindex user options, setting
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@findex :custom
|
|
|
|
In Emacs, you normally set customizable variables (user options) using
|
|
|
|
the @code{M-x customize} interface (@pxref{Easy Customization,,,
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
emacs, GNU Emacs Manual}). We recommend this method for most users.
|
2022-12-08 00:47:04 +01:00
|
|
|
However, it is also possible to set them in your @code{use-package}
|
|
|
|
declarations by using the @code{:custom} keyword.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
(use-package comint
|
2022-12-08 00:47:04 +01:00
|
|
|
:defer t
|
2017-12-04 12:11:59 -08:00
|
|
|
:custom
|
|
|
|
(comint-buffer-maximum-size 20000 "Increase comint buffer size.")
|
|
|
|
(comint-prompt-read-only t "Make the prompt read only."))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
This is better than using @code{setq} in a @code{:config} block, as
|
|
|
|
customizable variables might have some code associated with it that
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Emacs will execute when you assign values to them. (In Emacs 29 and
|
|
|
|
later, there is also the new @code{setopt} macro that does this for
|
|
|
|
you.)
|
|
|
|
|
|
|
|
Note that the values customized using @code{:custom} are @emph{not}
|
|
|
|
saved in the standard Emacs @code{custom-file} (@pxref{Saving
|
|
|
|
Customizations,,, emacs, GNU Emacs Manual}). You should therefore set
|
|
|
|
each user option using either the @code{:custom} keyword @emph{or}
|
|
|
|
@w{@kbd{M-x customize-option}} command; the latter will save
|
|
|
|
customized values in the Emacs @code{custom-file}. Do not use both
|
|
|
|
for the same variable, as this risks having conflicting values in your
|
|
|
|
use-package declaration and your @code{custom-file}, which can lead to
|
|
|
|
problems that are both tricky and tedious to debug.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2024-11-09 11:55:49 +02:00
|
|
|
Also note that if you use @code{:custom} in a file that you
|
|
|
|
byte-compile, you could have some unexpected results if you later load
|
|
|
|
or @code{require} @file{use-package} (e.g., due to lazy loading): the
|
|
|
|
value of the corresponding user options could be reset back to their
|
|
|
|
initial values. We therefore recommend against byte-compiling files
|
|
|
|
that use @file{use-package} with @code{:custom} settings.
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Faces
|
|
|
|
@section Faces
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex faces, setting
|
|
|
|
@cindex customization of faces
|
2022-12-08 00:47:04 +01:00
|
|
|
|
2022-12-08 01:49:04 +01:00
|
|
|
@findex :custom-face
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
The @code{:custom-face} keyword allows customization of package's
|
|
|
|
faces. Example:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
(use-package eruby-mode
|
|
|
|
:custom-face
|
|
|
|
(eruby-standard-face ((t (:slant italic)))))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package example
|
|
|
|
:custom-face
|
|
|
|
(example-1-face ((t (:foreground "LightPink"))))
|
|
|
|
(example-2-face ((t (:foreground "LightGreen"))) face-defspec-spec))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package zenburn-theme
|
|
|
|
:preface
|
|
|
|
(setq my/zenburn-colors-alist
|
|
|
|
'((fg . "#DCDCCC") (bg . "#1C1C1C") (cyan . "#93E0E3")))
|
|
|
|
:custom-face
|
|
|
|
(region ((t (:background ,(alist-get my/zenburn-colors-alist 'cyan)))))
|
|
|
|
:config
|
|
|
|
(load-theme 'zenburn t))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Hiding minor modes
|
|
|
|
@section Hiding minor modes with diminish and delight
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex hiding minor modes
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@code{use-package} supports the @file{diminish} and @file{delight}
|
|
|
|
packages, both of which make it possible to remove or change minor mode
|
|
|
|
strings in your mode-line. Which one to use is up to you, but you
|
|
|
|
should normally only use one or the other -- never both.@footnote{When
|
|
|
|
in doubt, you might as well use @file{diminish}.} To use either of them, you
|
|
|
|
must first install the corresponding package from @acronym{GNU} @acronym{ELPA}.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@menu
|
|
|
|
* Diminish:: Hiding minor modes with Diminish.
|
|
|
|
* Delight:: Hiding minor modes with Delight.
|
|
|
|
@end menu
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Diminish
|
|
|
|
@subsection Diminish
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@findex :diminish
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
When diminish@footnote{The @file{diminish} package is installable from
|
|
|
|
@acronym{GNU} @acronym{ELPA}.} is installed, you can use the @code{:diminish}
|
|
|
|
keyword. If @file{diminish} is not installed, the @code{:diminish} keyword
|
2022-12-09 06:27:33 +01:00
|
|
|
does nothing.
|
|
|
|
|
|
|
|
First, add the following declaration to the beginning of your init
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
file.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package diminish :ensure t)
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@noindent
|
|
|
|
The optional @w{@code{:ensure t}} makes sure the package is installed
|
|
|
|
if it isn't already (@pxref{Installing packages}).
|
|
|
|
|
|
|
|
The @code{:diminish} keyword takes as its argument either a minor mode
|
|
|
|
symbol, a cons of the symbol and its replacement string, or just a
|
|
|
|
replacement string, in which case the minor mode symbol is guessed to
|
|
|
|
be the package name with @samp{-mode} appended at the end:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
(use-package abbrev
|
|
|
|
:diminish abbrev-mode
|
|
|
|
:config
|
|
|
|
(if (file-exists-p abbrev-file-name)
|
|
|
|
(quietly-read-abbrev-file)))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Delight
|
|
|
|
@subsection Delight
|
|
|
|
|
|
|
|
@findex :delight
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
When @file{delight}@footnote{The @file{delight} package is installable from
|
|
|
|
@acronym{GNU} @acronym{ELPA}.} is installed, you can use the
|
|
|
|
@code{:delight} keyword. If @file{delight} is not installed, the
|
|
|
|
@code{:delight} keyword does nothing.
|
2022-12-09 06:27:33 +01:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
First, add the following declaration to the beginning of your init
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
file.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@lisp
|
|
|
|
(use-package delight :ensure t)
|
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@noindent
|
|
|
|
The optional @w{@code{:ensure t}} makes sure the package is installed
|
|
|
|
if it isn't already (@pxref{Installing packages}).
|
|
|
|
|
|
|
|
The @code{:delight} keyword takes as its argument a minor mode symbol,
|
|
|
|
a replacement string, or quoted mode line data (in which case the
|
|
|
|
minor mode symbol is assumed to be the package name with @samp{-mode}
|
|
|
|
appended at the end), both of these, or several lists of both.
|
|
|
|
@xref{Mode Line Data,,, elisp, GNU Emacs Lisp Reference Manual}. If
|
|
|
|
no arguments are provided, the default mode name is hidden completely.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-09 06:27:33 +01:00
|
|
|
For example, the following hides everything for the @samp{foo-mode}
|
|
|
|
minor mode in the @samp{foo} package:
|
|
|
|
|
2017-12-04 12:11:59 -08:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-09 06:27:33 +01:00
|
|
|
(use-package foo
|
2017-12-04 12:11:59 -08:00
|
|
|
:delight)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-09 06:27:33 +01:00
|
|
|
@end lisp
|
|
|
|
|
|
|
|
If the mode name doesn't match the package name with @samp{-mode}
|
|
|
|
appended, provide a symbol instead. For example, the following hides
|
|
|
|
@code{auto-revert-mode} from the mode line:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-09 06:27:33 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
;; Don't show anything for auto-revert-mode, which doesn't match
|
|
|
|
;; its package name.
|
|
|
|
(use-package autorevert
|
|
|
|
:delight auto-revert-mode)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-09 06:27:33 +01:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
You can also use arbitrary Lisp code as argument of @code{:delight}.
|
|
|
|
For example, to replace @samp{foo-mode} with the value of the current
|
|
|
|
buffer:
|
2022-12-09 06:27:33 +01:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-09 06:27:33 +01:00
|
|
|
(use-package foo
|
|
|
|
:delight '(:eval buffer-file-name))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-09 06:27:33 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-09 06:27:33 +01:00
|
|
|
Here is an example of hiding several built-in minor modes:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-09 06:27:33 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
;; Completely hide visual-line-mode and change auto-fill-mode to " AF".
|
|
|
|
(use-package emacs
|
|
|
|
:delight
|
|
|
|
(auto-fill-function " AF")
|
|
|
|
(visual-line-mode))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@c ----------------------------------------------------------------------------
|
|
|
|
@node Installing packages
|
|
|
|
@chapter Installing packages automatically
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
The standard Emacs package manager is documented in the Emacs manual
|
|
|
|
(@pxref{Package Installation,,, emacs, GNU Emacs Manual}). The
|
|
|
|
@code{use-package} macro provides the @code{:ensure} and @code{:pin}
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
keywords that interface with that package manager to automatically
|
2022-12-29 11:05:04 +01:00
|
|
|
install packages. The @code{:vc} keyword may be used to control how
|
|
|
|
package sources are downloaded; e.g., from remote hosts
|
|
|
|
(@pxref{Fetching Package Sources,,, emacs, GNU Emacs Manual}). This
|
|
|
|
is particularly useful if you use your init file on more than one
|
|
|
|
system.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@menu
|
|
|
|
* Install package::
|
|
|
|
* Pinning packages::
|
|
|
|
* Other package managers::
|
|
|
|
@end menu
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Install package
|
|
|
|
@section Installing package
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex installing packages from archives
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 01:49:04 +01:00
|
|
|
@findex :ensure
|
2022-12-08 00:47:04 +01:00
|
|
|
The @code{:ensure} keyword makes use-package ask the Emacs package
|
|
|
|
manager to install a package if it is not already present on your
|
|
|
|
system.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
For example:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
(use-package magit
|
|
|
|
:ensure t)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
|
|
|
If you need to install a different package from the one named by
|
2022-12-08 00:47:04 +01:00
|
|
|
@code{use-package}, you can use a symbol:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
(use-package tex
|
|
|
|
:ensure auctex)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@vindex use-package-always-ensure
|
2022-12-08 00:47:04 +01:00
|
|
|
You can customize the user option @code{use-package-always-ensure} to
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
a non-@code{nil} value if you want this behavior to be global for all
|
|
|
|
packages:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(require 'use-package-ensure)
|
|
|
|
(setq use-package-always-ensure t)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@noindent
|
|
|
|
You can override the above setting for a single package by adding
|
|
|
|
@w{@code{:ensure nil}} to its declaration.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-29 11:05:04 +01:00
|
|
|
@findex :vc
|
|
|
|
The @code{:vc} keyword can be used to control how packages are
|
2024-07-21 16:33:08 +02:00
|
|
|
downloaded and/or installed. More specifically, it allows one to fetch
|
|
|
|
and update packages directly from a version control system. This is
|
2022-12-29 11:05:04 +01:00
|
|
|
especially convenient when wanting to install a package that is not on
|
|
|
|
any package archive.
|
|
|
|
|
|
|
|
The keyword accepts the same arguments as specified in
|
|
|
|
@pxref{Fetching Package Sources,,, emacs, GNU Emacs Manual}, except
|
|
|
|
that a name need not explicitly be given: it is inferred from the
|
|
|
|
declaration. The accepted property list is augmented by a @code{:rev}
|
|
|
|
keyword, which has the same shape as the @code{REV} argument to
|
|
|
|
@code{package-vc-install}. Notably -- even when not specified --
|
|
|
|
@code{:rev} defaults to checking out the last release of the package.
|
|
|
|
You can use @code{:rev :newest} to check out the latest commit.
|
|
|
|
|
|
|
|
For example,
|
|
|
|
|
|
|
|
@example
|
|
|
|
@group
|
|
|
|
(use-package bbdb
|
|
|
|
:vc (:url "https://git.savannah.nongnu.org/git/bbdb.git"
|
|
|
|
:rev :newest))
|
|
|
|
@end group
|
|
|
|
@end example
|
|
|
|
|
|
|
|
would try -- by invoking @code{package-vc-install} -- to install the
|
|
|
|
latest commit of the package @code{foo} from the specified remote.
|
|
|
|
|
2023-12-21 17:51:09 +01:00
|
|
|
@vindex use-package-vc-prefer-newest
|
|
|
|
Alternatively, the @code{use-package-vc-prefer-newest} user option
|
|
|
|
exists to always prefer the latest commit.
|
|
|
|
|
|
|
|
The @code{:vc} keyword can also be used for local packages, by
|
|
|
|
combining it with @code{:load-path} (@pxref{Load path}):
|
2022-12-29 11:05:04 +01:00
|
|
|
|
|
|
|
@example
|
|
|
|
@group
|
|
|
|
;; Use a local copy of BBDB instead of the one from GNU ELPA.
|
|
|
|
(use-package bbdb
|
|
|
|
:vc t
|
|
|
|
:load-path "/path/to/bbdb/dir/")
|
|
|
|
@end group
|
|
|
|
@end example
|
|
|
|
|
|
|
|
The above dispatches to @code{package-vc-install-from-checkout}.
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Pinning packages
|
|
|
|
@section Pinning packages using @code{:pin}
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex installing package from specific archive
|
|
|
|
@cindex pinning a package to archive
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@findex :pin
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
use-package can @dfn{pin} a package to a specific archive using the
|
2022-12-08 00:47:04 +01:00
|
|
|
@code{:pin} keyword.@footnote{The @code{:pin} keyword has no effect on
|
|
|
|
Emacs versions older than 24.4.} This allows you to mix and match
|
|
|
|
packages from different archives. The primary use-case for this is
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
preferring to install packages from @acronym{GNU} @acronym{ELPA} or
|
|
|
|
@acronym{NonGNU} @acronym{ELPA} (indicated by @code{gnu} and @code{nongnu},
|
2022-12-08 00:47:04 +01:00
|
|
|
respectively), while installing specific packages from third-party
|
|
|
|
archives.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
For example:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
(use-package company
|
|
|
|
:ensure t
|
2022-12-08 00:47:04 +01:00
|
|
|
:pin gnu) ; GNU ELPA
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@vindex use-package-always-pin
|
|
|
|
Unfortunately, the third-party archive @acronym{MELPA} uses a
|
|
|
|
versioning scheme based on dates, which means that packages from that
|
|
|
|
archive are always preferred. If you are using that archive, we
|
|
|
|
strongly encourage you to customize @code{use-package-always-pin} to
|
|
|
|
@code{nongnu}. This guarantees that you are using a version of that
|
|
|
|
package that has been specifically marked for release by its
|
|
|
|
developer, and not a development snapshot.
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex manual update of packages
|
2022-12-08 00:47:04 +01:00
|
|
|
@c FIXME: This needs clarifying. AFAIK, :ensure does not update packages.
|
|
|
|
If you want to manually keep a package updated and ignore upstream
|
|
|
|
updates, you can pin it to @samp{manual}. This will work as long as
|
|
|
|
you have not customized a repository to use that name in the
|
|
|
|
@code{package-archives} variable.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
Example:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2017-12-04 12:11:59 -08:00
|
|
|
(use-package org
|
|
|
|
:ensure t
|
|
|
|
;; ignore org-mode from upstream and use a manually installed version
|
|
|
|
:pin manual)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@code{use-package} signals an error if you try to pin a package to an
|
|
|
|
archive that is not configured using @code{package-archives} (except
|
|
|
|
from the special @samp{manual} archive).
|
|
|
|
|
|
|
|
@node Other package managers
|
|
|
|
@section Non-standard package managers
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex non-standard package managers
|
|
|
|
@cindex package managers, other than @file{package.el}
|
2022-12-09 16:50:13 +02:00
|
|
|
@cindex installing using non-standard package managers
|
2022-12-08 00:47:04 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
By default, use-package assumes that you are using the Emacs built-in
|
|
|
|
@file{package.el} package manager. We expect that most users will
|
|
|
|
find that it is capable enough, even for advanced use cases.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@vindex use-package-ensure-function
|
|
|
|
However, some users might prefer to use a third-party package manager
|
|
|
|
for a specific circumstance or use case. By setting the user option
|
|
|
|
@code{use-package-ensure-function} to the name of a function, you can
|
|
|
|
direct @code{:ensure} to use a different package manager for
|
|
|
|
installing packages.
|
|
|
|
|
|
|
|
For more details, please see the documentation of the package manager
|
|
|
|
you are using. If you run into any bugs, it is often best to report
|
|
|
|
them directly to the developers of that package manager.
|
|
|
|
|
|
|
|
@c ----------------------------------------------------------------------------
|
|
|
|
@node Byte-compiling
|
|
|
|
@chapter Byte-compiling your init file
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex byte-compiling your init file
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
Some users might want to byte-compile their init file to make Emacs
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
startup faster. This is not recommended in most cases, as the
|
2022-12-10 12:59:30 +01:00
|
|
|
speed-up is usually too small to be worth it, and it can lead to
|
|
|
|
confusion if the byte-compiled files are out-of-date. If you still
|
|
|
|
want to do it, this chapter explains how to do that.
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@code{use-package} always loads every library that it can while a file
|
|
|
|
is being byte-compiled. This helps silence spurious warnings about
|
|
|
|
unknown variables and functions.
|
|
|
|
|
|
|
|
@findex :defines
|
|
|
|
@findex :functions
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex silence byte-compilation warnings
|
2022-12-08 00:47:04 +01:00
|
|
|
However, there are times when this is just not enough. For those
|
|
|
|
times, use the @code{:defines} and @code{:functions} keywords to
|
|
|
|
introduce dummy variable and function declarations solely for the sake
|
|
|
|
of silencing byte-compiler warnings. For example:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package texinfo
|
|
|
|
:defines texinfo-section-list
|
|
|
|
:commands texinfo-mode
|
|
|
|
:init
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.texi$" . texinfo-mode)))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
If you need to silence a missing function warning, you can use
|
|
|
|
@code{:functions}:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package ruby-mode
|
|
|
|
:mode "\\.rb\\'"
|
|
|
|
:interpreter "ruby"
|
|
|
|
:functions inf-ruby-keys
|
|
|
|
:config
|
|
|
|
(defun my-ruby-mode-hook ()
|
|
|
|
(require 'inf-ruby)
|
|
|
|
(inf-ruby-keys))
|
|
|
|
(add-hook 'ruby-mode-hook 'my-ruby-mode-hook))
|
2022-12-10 21:25:04 +01:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@findex :no-require
|
|
|
|
@cindex prevent a package from loading at compile-time
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex package loading at byte-compilation time, prevent
|
2022-12-08 00:47:04 +01:00
|
|
|
Normally, @code{use-package} will load each package at compile time
|
|
|
|
before compiling the configuration, to ensure that any necessary
|
|
|
|
symbols are in scope to satisfy the byte-compiler. At times this can
|
|
|
|
cause problems, since a package may have special loading requirements,
|
|
|
|
and all that you want to use @code{use-package} for is to add a
|
|
|
|
configuration to the @code{eval-after-load} hook. In such cases, use
|
|
|
|
the @code{:no-require} keyword:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:no-require t
|
|
|
|
:config
|
|
|
|
(message "Evaluate this immediately after loading `foo'"))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@c ----------------------------------------------------------------------------
|
|
|
|
@node Troubleshooting
|
|
|
|
@chapter Troubleshooting
|
2017-12-04 12:11:59 -08:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex troubleshooting use-package
|
|
|
|
@cindex debugging use-package
|
2022-12-08 00:47:04 +01:00
|
|
|
If an error occurs while initializing or configuring a package, this
|
|
|
|
will not stop your Emacs from loading. Instead, @code{use-package}
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
captures the error and reports it in a special @file{*Warnings*} popup
|
2022-12-08 00:47:04 +01:00
|
|
|
buffer, so that you can debug the situation in an otherwise functional
|
|
|
|
Emacs.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
If you are having trouble when starting Emacs, you can pass Emacs the
|
|
|
|
@samp{--debug-init} command line flag. @xref{Initial Options,,,
|
|
|
|
emacs, GNU Emacs Manual}. To get even more information when using
|
|
|
|
that flag, add the following to your init file (these options are
|
|
|
|
documented below):
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(when init-file-debug
|
|
|
|
(setq use-package-verbose t
|
|
|
|
use-package-expand-minimally nil
|
|
|
|
use-package-compute-statistics t
|
|
|
|
debug-on-error t))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@cindex reporting bugs
|
|
|
|
@cindex expanding macro, for troubleshooting
|
|
|
|
Since @code{use-package} is a macro, the first step when you need to
|
|
|
|
dig deeper is usually to see what Emacs Lisp code your declaration
|
|
|
|
expands to. You can either use the command @w{@kbd{M-x
|
|
|
|
pp-macroexpand-last-sexp}}, or wrap the use-package declaration in
|
|
|
|
@code{macroexpand} and evaluate it. It is a good idea to include
|
|
|
|
their output in any bugs you file for use-package.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@menu
|
|
|
|
* Troubleshooting Options::
|
|
|
|
* Gathering Statistics::
|
|
|
|
* Disabling a package::
|
|
|
|
@end menu
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Troubleshooting Options
|
|
|
|
@section Options that help when troubleshooting
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex options for troubleshooting
|
|
|
|
@cindex troubleshooting, options that help
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@vindex use-package-expand-minimally
|
|
|
|
By default, use-package will attempts to catch and report errors that
|
|
|
|
occur during expansion of use-package declarations in your init file.
|
|
|
|
Customize the user option @code{use-package-expand-minimally} to a
|
|
|
|
non-@code{nil} value to disable this checking.
|
|
|
|
|
|
|
|
@findex :catch
|
|
|
|
This behavior may be overridden locally using the @code{:catch}
|
|
|
|
keyword. If @code{t} or @code{nil}, it enables or disables catching
|
|
|
|
errors at load time. It can also be a function taking two arguments:
|
|
|
|
the keyword being processed at the time the error was encountered, and
|
|
|
|
the error object (as generated by @code{condition-case}). For
|
|
|
|
example:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package example
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
;; Note that errors are never trapped in the preface, since
|
|
|
|
;; doing so would hide definitions from the byte-compiler.
|
2022-12-08 00:47:04 +01:00
|
|
|
:preface (message "I'm here at byte-compile and load time")
|
|
|
|
:init (message "I'm always here at startup")
|
|
|
|
:config
|
|
|
|
(message "I'm always here after the package is loaded")
|
|
|
|
(error "oops")
|
|
|
|
;; Don't try to (require 'example), this is just an example!
|
|
|
|
:no-require t
|
|
|
|
:catch (lambda (keyword err)
|
|
|
|
(message (error-message-string err))))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
Evaluating the above form will print these messages:
|
|
|
|
|
|
|
|
@verbatim
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
I'm here at byte-compile and load time
|
|
|
|
I'm always here at startup
|
2022-12-08 00:47:04 +01:00
|
|
|
Configuring package example...
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
I'm always here after the package is loaded
|
2022-12-08 00:47:04 +01:00
|
|
|
oops
|
|
|
|
@end verbatim
|
|
|
|
|
|
|
|
@node Gathering Statistics
|
|
|
|
@section Gathering Statistics
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex gathering use-package statistics
|
|
|
|
@cindex usage statistics for use-package
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
@vindex use-package-verbose
|
|
|
|
When a package is loaded, and if you have @code{use-package-verbose}
|
|
|
|
set to @code{t}, or if the package takes longer than 0.1 seconds to
|
|
|
|
load, you will see a message to indicate this loading activity in the
|
|
|
|
@code{*Messages*} buffer. The same will happen for configuration, or
|
|
|
|
@code{:config} blocks, that take longer than 0.1 seconds to execute.
|
|
|
|
|
|
|
|
@vindex use-package-compute-statistics
|
|
|
|
If you'd like to see a summary how many packages you've loaded, what
|
|
|
|
stage of initialization they've reached, and how much aggregate time
|
|
|
|
they've spent (roughly), you can customize the user option
|
|
|
|
@code{use-package-compute-statistics} to a non-@code{nil} value. Then
|
|
|
|
reload your packages, normally by restarting Emacs, to make sure that
|
|
|
|
use-package can gather statistics for all your packages.
|
|
|
|
|
|
|
|
@cindex use-package-report
|
2022-12-08 06:36:44 +01:00
|
|
|
Run the command @kbd{M-x use-package-report} to see the results. The
|
2022-12-08 00:47:04 +01:00
|
|
|
buffer displayed is a tabulated list. To sort rows based on a
|
|
|
|
particular column, move point to it and type @kbd{S}, or click the
|
|
|
|
column name at the top of the buffer on graphical displays.
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@findex use-package-reset-statistics
|
2022-12-08 06:36:44 +01:00
|
|
|
To reset all statistics that use-package has gathered for the current
|
|
|
|
Emacs invocation, run the command @kbd{M-x use-package-reset-statistics}.
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Note that if you are setting @code{use-package-compute-statistics}
|
2022-12-08 00:47:04 +01:00
|
|
|
directly in your init file, and not with @code{customize}, you must do
|
2022-12-08 06:36:44 +01:00
|
|
|
this after loading @code{use-package}, but before any
|
2022-12-08 00:47:04 +01:00
|
|
|
@code{use-package} forms.
|
|
|
|
|
|
|
|
@node Disabling a package
|
|
|
|
@section Disabling a package
|
|
|
|
@cindex disable package
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@findex :disabled
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
The @code{:disabled} keyword inhibits loading a package, and all its
|
2022-12-08 00:47:04 +01:00
|
|
|
customizations. It is equivalent to commenting out or deleting the
|
|
|
|
definition.
|
|
|
|
|
|
|
|
You could use this, for example, to temporarily disable a package that
|
|
|
|
you're having difficulties with, or to avoid loading a package that
|
|
|
|
you're not currently using.
|
|
|
|
|
|
|
|
This example disables the @samp{foo} package:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:disabled)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
When byte-compiling your init file, use-package omits disabled
|
|
|
|
declarations from the output entirely, in order to make Emacs startup
|
|
|
|
faster.
|
|
|
|
|
|
|
|
@c ----------------------------------------------------------------------------
|
|
|
|
@node Keyword extensions
|
|
|
|
@appendix Keyword extensions
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@cindex keyword extension
|
|
|
|
@cindex extending use-package keywords
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
use-package is based on an extensible framework that makes it easy for
|
|
|
|
package authors to add new keywords, or modify the behavior of
|
|
|
|
existing keywords.
|
|
|
|
|
|
|
|
Some keyword extensions are included with @code{use-package}, and can
|
|
|
|
be optionally enabled.
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* use-package-ensure-system-package::
|
|
|
|
* Creating an extension::
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
@node use-package-ensure-system-package
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@appendixsec :use-package-ensure-system-package
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@findex :ensure-system-package
|
|
|
|
The @code{:ensure-system-package} keyword allows you to ensure certain
|
|
|
|
executables are available on your system alongside your package
|
2022-12-11 00:30:28 +01:00
|
|
|
declarations.@footnote{On macOS, your @code{exec-path} might be
|
|
|
|
different if you are starting Emacs as a GUI app instead of from a
|
|
|
|
shell. If you find that Emacs on macOS cannot find some executables
|
|
|
|
that you know are already installed, you could try the
|
2022-12-08 00:47:04 +01:00
|
|
|
@uref{https://github.com/purcell/exec-path-from-shell,@samp{exec-path-from-shell}}
|
2022-12-11 00:30:28 +01:00
|
|
|
package.}
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
To use this extension, add this immediately after loading
|
|
|
|
@code{use-package}:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package use-package-ensure-system-package)
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
Now you can use the @code{:ensure-system-package} keyword.
|
|
|
|
Here's an example usage:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:ensure-system-package foo)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
This will expect a global binary package to exist called @code{foo}.
|
|
|
|
If it does not, it will use your system package manager to attempt an
|
|
|
|
install of a binary by the same name asynchronously. This requires
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
the @acronym{GNU} @acronym{ELPA} package
|
2022-12-08 00:47:04 +01:00
|
|
|
@uref{https://gitlab.com/jabranham/system-packages,@samp{system-packages}},
|
|
|
|
so for this to work you must install that first.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
One way of making sure it is installed is with @code{use-package}
|
|
|
|
together with @code{:ensure}.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package system-packages
|
|
|
|
:ensure t)
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-10 12:59:30 +01:00
|
|
|
For example, on a Debian GNU/Linux system, this would call
|
2022-12-08 00:47:04 +01:00
|
|
|
@samp{apt-get install foo}.
|
|
|
|
|
|
|
|
If the package is named differently than the binary, you can use a
|
|
|
|
cons in the form of @code{(binary . package-name)}. For example:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package foo
|
|
|
|
:ensure-system-package
|
|
|
|
(foocmd . foo))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-10 12:59:30 +01:00
|
|
|
On a Debian GNU/Linux system, this would call @code{apt install foo}
|
|
|
|
if Emacs could not locate the executable @code{foocmd}.@footnote{For
|
|
|
|
manual testing, you could use the @code{executable-find} function,
|
|
|
|
which is what @samp{system-packages} uses internally.}
|
2022-12-08 00:47:04 +01:00
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@code{:ensure-system-package} can also take a cons where the
|
2022-12-08 00:47:04 +01:00
|
|
|
@code{cdr} is a string that will get called by
|
|
|
|
@code{(async-shell-command)} to install if it isn't found. This does
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
not depend on any external package.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package tern
|
|
|
|
:ensure-system-package (tern . "npm i -g tern"))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
To install several packages, you can pass in a list of conses:
|
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package ruby-mode
|
|
|
|
:ensure-system-package
|
|
|
|
((rubocop . "gem install rubocop")
|
|
|
|
(ruby-lint . "gem install ruby-lint")
|
|
|
|
(ripper-tags . "gem install ripper-tags")
|
|
|
|
(pry . "gem install pry")))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-12-08 00:47:04 +01:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
Finally, in case the package dependency does not provide a global
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
executable, you can ensure that packages exist by checking the
|
|
|
|
presence of a file by providing a string like so:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-04-04 21:10:44 +02:00
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(use-package dash-at-point
|
|
|
|
:if (eq system-type 'darwin)
|
|
|
|
:ensure-system-package
|
|
|
|
("/Applications/Dash.app" . "brew cask install dash"))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2022-04-04 21:10:44 +02:00
|
|
|
@end lisp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@code{:ensure-system-package} will use @code{system-packages-install}
|
|
|
|
to install system packages, except where a custom command has been
|
|
|
|
specified, in which case it will be executed verbatim by
|
|
|
|
@code{async-shell-command}.
|
|
|
|
|
|
|
|
The user options @code{system-packages-package-manager} and
|
|
|
|
@code{system-packages-use-sudo} are honored, but not for custom
|
|
|
|
commands. Custom commands should include the call to sudo in the
|
|
|
|
command if needed.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Creating an extension
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@appendixsec How to create an extension keyword
|
|
|
|
@cindex extension keywords
|
2022-12-08 00:47:04 +01:00
|
|
|
|
|
|
|
This section describes how to create a new keyword.
|
|
|
|
|
|
|
|
@enumerate
|
|
|
|
@item
|
|
|
|
Add the keyword.
|
|
|
|
|
|
|
|
The first step is to add your keyword at the right place in
|
|
|
|
@code{use-package-keywords}. This list determines the order in which
|
|
|
|
things will happen in the expanded code. You should never change this
|
|
|
|
order, but it gives you a framework within which to decide when your
|
|
|
|
keyword should fire.
|
|
|
|
|
|
|
|
@item
|
|
|
|
Create a normalizer.
|
|
|
|
|
|
|
|
The job of the normalizer is take a list of arguments (possibly
|
|
|
|
@code{nil}), and turn it into the single argument (which could still
|
|
|
|
be a list) that should appear in the final property list used by
|
|
|
|
@code{use-package}.
|
|
|
|
|
|
|
|
Define a normalizer for your keyword by defining a function named
|
|
|
|
after the keyword, for example:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(defun use-package-normalize/:pin (name-symbol keyword args)
|
|
|
|
(use-package-only-one (symbol-name keyword) args
|
|
|
|
(lambda (label arg)
|
|
|
|
(cond
|
|
|
|
((stringp arg) arg)
|
|
|
|
((symbolp arg) (symbol-name arg))
|
|
|
|
(t
|
|
|
|
(use-package-error
|
|
|
|
":pin wants an archive name (a string)"))))))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@item
|
|
|
|
Create a handler.
|
|
|
|
|
|
|
|
Once you have a normalizer, you must create a handler for the keyword.
|
|
|
|
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
Handlers can affect the handling of keywords in two ways. First, they
|
2022-12-08 00:47:04 +01:00
|
|
|
can modify the @code{state} plist before recursively processing the
|
|
|
|
remaining keywords, to influence keywords that pay attention to the
|
|
|
|
state (one example is the state keyword @code{:deferred}, not to be
|
|
|
|
confused with the @code{use-package} keyword @code{:defer}). Then,
|
|
|
|
once the remaining keywords have been handled and their resulting
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
forms returned, the handlers may manipulate, extend, or just ignore
|
2022-12-08 00:47:04 +01:00
|
|
|
those forms.
|
|
|
|
|
|
|
|
The task of each handler is to return a @emph{list of forms}
|
|
|
|
representing code to be inserted. It does not need to be a
|
|
|
|
@code{progn} list, as this is handled automatically in other places.
|
|
|
|
Thus it is common to see the idiom of using @code{use-package-concat}
|
|
|
|
to add new functionality before or after a code body, so that only the
|
|
|
|
minimum code necessary is emitted as the result of a
|
|
|
|
@code{use-package} expansion.
|
|
|
|
|
|
|
|
This is an example handler:
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@lisp
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@group
|
2022-12-08 00:47:04 +01:00
|
|
|
(defun use-package-handler/:pin (name-symbol keyword archive-name rest state)
|
|
|
|
(let ((body (use-package-process-keywords name-symbol rest state)))
|
|
|
|
;; This happens at macro expansion time, not when the expanded code is
|
|
|
|
;; compiled or evaluated.
|
|
|
|
(if (null archive-name)
|
|
|
|
body
|
|
|
|
(use-package-pin-package name-symbol archive-name)
|
|
|
|
(use-package-concat
|
|
|
|
body
|
|
|
|
`((push '(,name-symbol . ,archive-name)
|
|
|
|
package-pinned-packages))))))
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
@end group
|
2017-12-04 12:11:59 -08:00
|
|
|
@end lisp
|
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@item
|
|
|
|
Test it.
|
|
|
|
|
|
|
|
After the keyword has been inserted into @code{use-package-keywords},
|
; Improve the use-package manual
* doc/misc/use-package.texi (Top, Basic Concepts)
(Getting Started, Loading Packages, Loading basics)
(Deferring loading, Forcing loading, Conditional loading)
(Loading sequentially, Load dependencies, Load path)
(Manual autoloads, Configuring Packages, Lisp Configuration)
(Preface keyword, Init keyword, Best practices, Key bindings)
(Global keybindings, Binding in keymaps, Binding to a keymap)
(Binding to repeat-maps, Displaying keybindings)
(Modes and interpreters, Magic handlers, User options, Faces)
(Delight, Diminish, Install package, Pinning packages)
(Other package managers, Byte-compiling, Troubleshooting)
(Troubleshooting Options, Gathering Statistics)
(Disabling a package, Keyword extensions)
(use-package-ensure-system-package, Creating an extension): Fix
wording, punctuation, typos, and markup; add indexing. Add
@group..@end group in code examples.
2022-12-09 16:32:59 +02:00
|
|
|
and a normalizer and a handler has been defined, you can now test the
|
|
|
|
keyword by seeing how usages of the keyword will expand. For this,
|
|
|
|
use @w{@kbd{M-x pp-macroexpand-last-sexp}} with the cursor set
|
|
|
|
immediately after the @code{(use-package @dots{})} expression.
|
2022-12-08 00:47:04 +01:00
|
|
|
@end enumerate
|
|
|
|
|
|
|
|
@c ----------------------------------------------------------------------------
|
|
|
|
@node History
|
|
|
|
@appendix History and acknowledgments
|
|
|
|
|
|
|
|
use-package was written by John Wiegley. Its development started in
|
|
|
|
2012, and it got merged into Emacs in 2022, in preparation of the
|
|
|
|
release of Emacs 29.1.
|
|
|
|
|
|
|
|
Dozens of people have contributed to use-package over the years with
|
|
|
|
bug reports, documentation and code. They are too many to list here,
|
|
|
|
but we thank them all for their contributions.
|
|
|
|
|
|
|
|
This Texinfo manual was written by Stefan Kangas, as a significant
|
|
|
|
rewrite of the old use-package manual and @file{README}.
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node GNU Free Documentation License
|
|
|
|
@appendix GNU Free Documentation License
|
|
|
|
@include doclicense.texi
|
2017-12-04 12:11:59 -08:00
|
|
|
|
2022-12-08 00:47:04 +01:00
|
|
|
@node Index
|
|
|
|
@unnumbered Index
|
|
|
|
@printindex cp
|
2017-12-04 12:11:59 -08:00
|
|
|
|
|
|
|
@bye
|