[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 4bd7ae833f 36/42: Allow the direct installation of package specif
From: |
Philip Kaludercic |
Subject: |
master 4bd7ae833f 36/42: Allow the direct installation of package specifications |
Date: |
Thu, 17 Nov 2022 14:56:25 -0500 (EST) |
branch: master
commit 4bd7ae833fd3e7922ca86c84fbccaaf1605bb08a
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Allow the direct installation of package specifications
* lisp/emacs-lisp/package-vc.el (package-vc-install): Handle package
specifications as an argument.
---
lisp/emacs-lisp/package-vc.el | 45 +++++++++++++++++++++++++++----------------
1 file changed, 28 insertions(+), 17 deletions(-)
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index e8cae75c9c..ad468cade6 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -631,20 +631,25 @@ If no such revision can be found, return nil."
(line-number-at-pos nil t))))))))
;;;###autoload
-(defun package-vc-install (name-or-url &optional name rev backend)
- "Fetch a package NAME-OR-URL and set it up for using with Emacs.
-If NAME-OR-URL is a URL, download the package from the repository
-at that URL; the function will try to guess the name of the package
-from the URL. Otherwise NAME-OR-URL should be a symbol whose name
-is the package name, and the URL for the package will be taken from
-the package's metadata.
+(defun package-vc-install (package &optional name rev backend)
+ "Fetch a PACKAGE and set it up for using with Emacs.
+
+If PACKAGE is a string containing an URL, download the package
+from the repository at that URL; the function will try to guess
+the name of the package from the URL. This can be overridden by
+passing the optional argument NAME. If PACKAGE is a cons-cell,
+it should have the form (NAME . SPEC), where NAME is a symbol
+indicating the package name and SPEC is a plist as described in
+`package-vc-selected-packages'. Otherwise PACKAGE should be a
+symbol whose name is the package name, and the URL for the
+package will be taken from the package's metadata.
+
By default, this function installs the last version of the package
available from its repository, but if REV is given and non-nil, it
specifies the revision to install. If REV has the special value
`:last-release' (interactively, the prefix argument), that stands
for the last released version of the package.
-When calling from Lisp, optional argument NAME overrides the package
-name as deduced from NAME-OR-URL.
+
Optional argument BACKEND specifies the VC backend to use for cloning
the package's repository; this is only possible if NAME-OR-URL is a URL,
a string. If BACKEND is omitted or nil, the function
@@ -663,17 +668,23 @@ regular package, but it will not remove a source package."
(and current-prefix-arg :last-release)))))
(package-vc--archives-initialize)
(cond
- ((null name-or-url)
+ ((null package)
(signal 'wrong-type-argument nil))
- ((and-let* (((stringp name-or-url))
- (backend (or backend (package-vc--guess-backend name-or-url))))
+ ((consp package)
+ (package-vc--unpack
+ (package-desc-create :name (car package)
+ :kind 'vc)
+ (cdr package)
+ rev))
+ ((and-let* (((stringp package))
+ (backend (or backend (package-vc--guess-backend package))))
(package-vc--unpack
(package-desc-create
- :name (or name (intern (file-name-base name-or-url)))
+ :name (or name (intern (file-name-base package)))
:kind 'vc)
- (list :vc-backend backend :url name-or-url)
+ (list :vc-backend backend :url package)
rev)))
- ((and-let* ((desc (assoc name-or-url package-archive-contents #'string=)))
+ ((and-let* ((desc (assoc package package-archive-contents #'string=)))
(package-vc--unpack
(let ((copy (copy-package-desc (cadr desc))))
(setf (package-desc-kind copy) 'vc)
@@ -683,9 +694,9 @@ regular package, but it will not remove a source package."
(url (alist-get :url extras))
(backend (package-vc--guess-backend url)))
(list :vc-backend backend :url url))
- (user-error "Package `%s' has no VC data" name-or-url))
+ (user-error "Package `%s' has no VC data" package))
rev)))
- ((user-error "Unknown package to fetch: %s" name-or-url))))
+ ((user-error "Unknown package to fetch: %s" package))))
;;;###autoload
(defun package-vc-checkout (pkg-desc directory &optional rev)
- master 348f7d263c 17/42: Move package spec documentation to 'package-vc-selected-packages', (continued)
- master 348f7d263c 17/42: Move package spec documentation to 'package-vc-selected-packages', Philip Kaludercic, 2022/11/17
- master 2b93d0e6f1 16/42: Fix type error in package-vc prompt function, Philip Kaludercic, 2022/11/17
- master 7c3d3fa44e 19/42: Improve robustness of documentation generation, Philip Kaludercic, 2022/11/17
- master ccd7ab84c5 20/42: Fix edebug spec for 'package--with-response-buffer', Philip Kaludercic, 2022/11/17
- master 496c578d9c 22/42: Have 'package-vc-selected-packages' consider all installed packages, Philip Kaludercic, 2022/11/17
- master a467afbd98 25/42: Mention package name when package is lacking VC data, Philip Kaludercic, 2022/11/17
- master 7ab556b576 29/42: Improve robustness of 'package-vc-update', Philip Kaludercic, 2022/11/17
- master 3326337776 30/42: Avoid destructive manipulation of 'package-vc--archive-spec-alist', Philip Kaludercic, 2022/11/17
- master 32f51f17c4 33/42: Remove temporary .texi files if used to build documentation, Philip Kaludercic, 2022/11/17
- master 228c247e6f 34/42: Remove duplicate package descriptions after updating, Philip Kaludercic, 2022/11/17
- master 4bd7ae833f 36/42: Allow the direct installation of package specifications,
Philip Kaludercic <=
- master 53c90abfa8 37/42: ; * lisp/emacs-lisp/package-vc.el: Update TODO, Philip Kaludercic, 2022/11/17
- master aadf07f5b8 05/42: Autoload 'package-vc-install-selected-packages', Philip Kaludercic, 2022/11/17
- master 9f4a433b27 12/42: Fix generation of documentation for source packages, Philip Kaludercic, 2022/11/17
- master aa56e50fe2 23/42: Raise 'wrong-type-argument' when installing package nil, Philip Kaludercic, 2022/11/17
- master d0ea38b5fe 27/42: Have 'vc-prepare-patch' handle prefix arguments., Philip Kaludercic, 2022/11/17
- master 2ed115fc3c 21/42: Fix indefinite loading of asynchronous downloads, Philip Kaludercic, 2022/11/17
- master a6cd44734d 18/42: Remove unused variable in 'package-vc--unpack', Philip Kaludercic, 2022/11/17
- master fd4da9151f 28/42: * lisp/vc/vc.el (vc-default-last-change): Use 'vc-call', Philip Kaludercic, 2022/11/17
- master c8e5069e6d 24/42: Add new command 'package-vc-update-all', Philip Kaludercic, 2022/11/17
- master 345bfd376e 31/42: Add missing elpa-package.eld to package test resources, Philip Kaludercic, 2022/11/17