package, without adding it to the package list, use
@code{package-vc-checkout}.
+@vindex package-vc-selected-packages
+@findex package-vc-ensure-packages
+ An alternative way to use @code{package-vc-install} is via the
+@code{package-vc-selected-packages} user option. This is an alist of
+packages to install, where each key is a package name and the value is
+@code{nil}, indicating that any revision is to install, a string,
+indicating a specific revision or a package specification plist. The
+side effect of setting the user option is to install the package, but
+the process can also be manually triggered using the function
+@code{package-vc-ensure-packages}. Here is an example of how the user
+option:
+
+@example
+@group
+(setopt package-vc-selected-packages
+ '((modus-themes . "0f39eb3fd9") ;specific revision
+ (auctex . nil) ;any revision
+ (foo ;a package specification
+ :url "https://git.sv.gnu.org/r/foo-mode.git"
+ :branch "trunk")))
+@end group
+@end example
+
@findex package-report-bug
@findex package-vc-prepare-patch
With the source checkout, you might want to reproduce a bug against
vc-handled-backends))
:version "29.1")
-(defun package-vc--select-packages (sym val)
- "Custom setter for `package-vc-selected-packages'.
-It will ensure that all the packages are installed as source
-packages. Finally SYM is set to VAL."
- (pcase-dolist (`(,(and (pred symbolp) name) . ,spec) val)
+(defun package-vc-ensure-packages ()
+ "Ensure source packages specified in `package-vc-selected-packages'."
+ (pcase-dolist (`(,(and (pred symbolp) name) . ,spec)
+ package-vc-selected-packages)
(let ((pkg-desc (cadr (assoc name package-alist #'string=))))
- (unless (and name (package-installed-p name) (package-vc-p pkg-desc))
+ (unless (and name (package-installed-p name)
+ (package-vc-p pkg-desc))
(cond
((null spec)
(package-vc-install name))
(package-vc-install name nil spec))
((listp spec)
(package-vc--archives-initialize)
- (package-vc--unpack pkg-desc spec))))))
- (custom-set-default sym val))
+ (package-vc--unpack pkg-desc spec)))))))
;;;###autoload
(defcustom package-vc-selected-packages '()
specification.
This user option differs from `package-selected-packages' in that
-it is meant to be specified manually."
+it is meant to be specified manually. You can also use the
+function `package-vc-selected-packages' to apply the changes."
:type '(alist :tag "List of ensured packages"
:key-type (symbol :tag "Package")
:value-type
(:lisp-dir string)
(:main-file string)
(:vc-backend symbol)))))
- :set #'package-vc--select-packages
+ :set (lambda (sym val)
+ (custom-set-default sym val)
+ (package-vc-ensure-packages))
:version "29.1")
(defvar package-vc--archive-spec-alist nil