1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00

Allow updating source packages

* lisp/emacs-lisp/package-vc.el (package-vc-update): Add new function.
* lisp/emacs-lisp/package.el (package-update): Use 'package-vc-update'.
This commit is contained in:
Philip Kaludercic 2022-08-11 13:23:51 +02:00
parent 9ddc23cd34
commit f5bb6b0131
No known key found for this signature in database
GPG Key ID: F2C3CC513DB89F66
2 changed files with 16 additions and 5 deletions

View File

@ -227,6 +227,12 @@ The output is written out into PKG-FILE."
t))))
package-archive-contents))
(defun package-vc-update (pkg-desc)
"Attempt to update the packager PKG-DESC."
(let ((default-directory (package-desc-dir pkg-desc)))
(with-demoted-errors "Error during package update: %S"
(vc-pull))))
(defun package-vc-fetch (name-or-url &optional name rev)
"Fetch the source of NAME-OR-URL.
If NAME-OR-URL is a URL, then the package will be downloaded from

View File

@ -2194,17 +2194,22 @@ to install it but still mark it as selected."
(message "Package `%s' installed." name))
(message "`%s' is already installed" name))))
(declare-function package-vc-update "package-vc" (pkg))
;;;###autoload
(defun package-update (name)
"Update package NAME if a newer version exists."
(interactive
(list (completing-read
"Update package: " (package--updateable-packages) nil t)))
(let ((package (if (symbolp name)
name
(intern name))))
(package-delete (cadr (assq package package-alist)) 'force)
(package-install package 'dont-select)))
(let* ((package (if (symbolp name)
name
(intern name)))
(pkg-desc (cadr (assq package package-alist))))
(if (eq (package-desc-kind pkg-desc) 'vc)
(package-vc-update pkg-desc)
(package-delete pkg-desc 'force)
(package-install package 'dont-select))))
(defun package--updateable-packages ()
;; Initialize the package system to get the list of package