From fba961176cd6ffb9998413f25956f7f6e044e064 Mon Sep 17 00:00:00 2001 From: Tony Zorman Date: Thu, 29 Dec 2022 12:23:56 +0100 Subject: [PATCH 2/2] ; Document use-package's :vc keyword * doc/misc/use-package.texi (Installing packages): (Install package): Add documentation for :vc and link to the related chapter in the Emacs manual. * etc/NEWS: Mention :vc keyword --- doc/misc/use-package.texi | 50 +++++++++++++++++++++++++++++++++++++-- etc/NEWS | 13 ++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/doc/misc/use-package.texi b/doc/misc/use-package.texi index 87105c4db0..d75cb67e08 100644 --- a/doc/misc/use-package.texi +++ b/doc/misc/use-package.texi @@ -1554,8 +1554,11 @@ Installing packages (@pxref{Package Installation,,, emacs, GNU Emacs Manual}). The @code{use-package} macro provides the @code{:ensure} and @code{:pin} keywords that interface with that package manager to automatically -install packages. This is particularly useful if you use your init -file on more than one system. +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. @menu * Install package:: @@ -1607,6 +1610,49 @@ Install package You can override the above setting for a single package by adding @w{@code{:ensure nil}} to its declaration. +@findex :vc +The @code{:vc} keyword can be used to control how packages are +downloaded and/or installed. More specifically, it allows one to fetch +and update packages directly from a version control system. This is +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. + +This can also be used for local packages, by combining it with the +@code{:load-path} (@pxref{Load path}) keyword: + +@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}. + @node Pinning packages @section Pinning packages using @code{:pin} @cindex installing package from specific archive diff --git a/etc/NEWS b/etc/NEWS index b989f80f3c..20f6751121 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -322,6 +322,19 @@ instead of: and another_expression): do_something() +** use-package + ++++ +*** New ':vc' keyword. +This keyword enables the user to control how packages are fetched by +utilising 'package-vc.el'. By default, it relays its arguments to +'package-vc-install', but -- when combined with the ':load-path' +keyword -- it can also call upon 'package-vc-install-from-checkout' +instead. If no revision is given via the ':rev' argument, use-package +falls back to the last release (via 'package-vc-install's +':last-release' argument). To check out the last commit, use ':rev +:newest'. + * New Modes and Packages in Emacs 30.1 -- 2.40.1