emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/setup b17b6564df: Add package-vc support to :package


From: ELPA Syncer
Subject: [elpa] externals/setup b17b6564df: Add package-vc support to :package
Date: Sat, 23 Nov 2024 12:59:01 -0500 (EST)

branch: externals/setup
commit b17b6564df8383c4553bdda7021e440b555df8e7
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Add package-vc support to :package
---
 setup.el | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/setup.el b/setup.el
index cf75ad8e7b..f9551fc6d9 100644
--- a/setup.el
+++ b/setup.el
@@ -555,14 +555,27 @@ If FUNCTION is a list, apply BODY to all elements of 
FUNCTION."
 
 (setup-define :package
   (lambda (package)
-    `(unless (package-installed-p ',package)
-       (unless (assq ',package package-archive-contents)
-         (package-refresh-contents))
-       (package-install ',package)))
+    (let ((name (if (consp package)
+                    (progn
+                      (unless (fboundp 'package-vc-install)
+                        (error "Package-vc is not available"))
+                      (car package))
+                  package)))
+      `(unless (package-installed-p ',name)
+         (unless (assq ',package package-archive-contents)
+           (package-refresh-contents))
+         ,(cond
+           ((and (consp package) (consp (cdr package)))
+            `(package-vc-install ',package))
+           ((consp package) `(package-vc-install ',(car package)))
+           (t `(package-install ',package))))))
   :documentation "Install PACKAGE if it hasn't been installed yet.
-The first PACKAGE can be used to deduce the feature context."
+The first PACKAGE can be used to deduce the feature context.  If PACKAGE
+is a cons-cell (NAME . SPEC), then the NAME is installed using
+`package-vc-install' using the specification SPEC.  If SPEC is nil, then
+default to the package specification provided by ELPA."
   :repeatable t
-  :shorthand #'cadr)
+  :shorthand (lambda (package) (or (car-safe (cadr package)) (cadr package))))
 
 (setup-define :autoload-this
   (lambda (&rest args)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]