diff options
author | Eli Zaretskii <eliz@gnu.org> | 2023-01-01 10:38:11 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2023-01-01 10:38:11 +0200 |
commit | ab3210e7092f6bd8465e7f653be73f0f124153f9 (patch) | |
tree | d760a23cac161cdaa8f40fcf629d3b318072c454 /doc/emacs/custom.texi | |
parent | f0e9775b1837e80b9fe2cf87d689cec23075f44c (diff) | |
download | emacs-ab3210e7092f6bd8465e7f653be73f0f124153f9.tar.gz emacs-ab3210e7092f6bd8465e7f653be73f0f124153f9.tar.bz2 emacs-ab3210e7092f6bd8465e7f653be73f0f124153f9.zip |
Document 'use-package' in the 2 main manuals
* doc/emacs/custom.texi (Init Examples):
* doc/lispref/loading.texi (Named Features): Document 'use-package'
and its most important features.
Diffstat (limited to 'doc/emacs/custom.texi')
-rw-r--r-- | doc/emacs/custom.texi | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index f75512a00e9..24a34552fb6 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -2701,6 +2701,28 @@ function is not defined. A @code{setq} on a variable which does not exist is generally harmless, so those do not need a conditional. + +@item +Using @code{use-package} to automatically load and configure a +package. + +@example +(use-package hi-lock + :defer t + :init (add-hook 'some-hook 'hi-lock-mode) + :config (use-package my-hi-lock) + :bind (("M-o l" . highlight-lines-matching-regexp) + ("M-o r" . highlight-regexp) + ("M-o w" . highlight-phrase))) +@end example + +@noindent +This will load @code{hi-lock} when some of its commands or variables +are first used, bind 3 keys to its commands, and additionally load the +@code{my-hi-lock} package (presumably further customizing +@code{hi-lock}) after loading @code{hi-lock}. The @code{use-package} +facility is fully documented in its own manual, @pxref{Top,,, +use-package, use-package User manual}. @end itemize @node Terminal Init |