diff options
| author | Philip Kaludercic | 2022-08-11 13:23:51 +0200 |
|---|---|---|
| committer | Philip Kaludercic | 2022-08-11 13:23:51 +0200 |
| commit | f5bb6b01318fe3a21493992e94908cf685e9b26b (patch) | |
| tree | eeeebdc4ca8b94fcdb322bdbcbd6aa85600ef5ca | |
| parent | 9ddc23cd3438cba85b8a41e78d335c0d5071a212 (diff) | |
| download | emacs-f5bb6b01318fe3a21493992e94908cf685e9b26b.tar.gz emacs-f5bb6b01318fe3a21493992e94908cf685e9b26b.zip | |
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'.
| -rw-r--r-- | lisp/emacs-lisp/package-vc.el | 6 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 15 |
2 files changed, 16 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 0f5ee4305a8..04821d43c4a 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el | |||
| @@ -227,6 +227,12 @@ The output is written out into PKG-FILE." | |||
| 227 | t)))) | 227 | t)))) |
| 228 | package-archive-contents)) | 228 | package-archive-contents)) |
| 229 | 229 | ||
| 230 | (defun package-vc-update (pkg-desc) | ||
| 231 | "Attempt to update the packager PKG-DESC." | ||
| 232 | (let ((default-directory (package-desc-dir pkg-desc))) | ||
| 233 | (with-demoted-errors "Error during package update: %S" | ||
| 234 | (vc-pull)))) | ||
| 235 | |||
| 230 | (defun package-vc-fetch (name-or-url &optional name rev) | 236 | (defun package-vc-fetch (name-or-url &optional name rev) |
| 231 | "Fetch the source of NAME-OR-URL. | 237 | "Fetch the source of NAME-OR-URL. |
| 232 | If NAME-OR-URL is a URL, then the package will be downloaded from | 238 | If NAME-OR-URL is a URL, then the package will be downloaded from |
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 1321c3728e8..1ee39f87529 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -2194,17 +2194,22 @@ to install it but still mark it as selected." | |||
| 2194 | (message "Package `%s' installed." name)) | 2194 | (message "Package `%s' installed." name)) |
| 2195 | (message "`%s' is already installed" name)))) | 2195 | (message "`%s' is already installed" name)))) |
| 2196 | 2196 | ||
| 2197 | (declare-function package-vc-update "package-vc" (pkg)) | ||
| 2198 | |||
| 2197 | ;;;###autoload | 2199 | ;;;###autoload |
| 2198 | (defun package-update (name) | 2200 | (defun package-update (name) |
| 2199 | "Update package NAME if a newer version exists." | 2201 | "Update package NAME if a newer version exists." |
| 2200 | (interactive | 2202 | (interactive |
| 2201 | (list (completing-read | 2203 | (list (completing-read |
| 2202 | "Update package: " (package--updateable-packages) nil t))) | 2204 | "Update package: " (package--updateable-packages) nil t))) |
| 2203 | (let ((package (if (symbolp name) | 2205 | (let* ((package (if (symbolp name) |
| 2204 | name | 2206 | name |
| 2205 | (intern name)))) | 2207 | (intern name))) |
| 2206 | (package-delete (cadr (assq package package-alist)) 'force) | 2208 | (pkg-desc (cadr (assq package package-alist)))) |
| 2207 | (package-install package 'dont-select))) | 2209 | (if (eq (package-desc-kind pkg-desc) 'vc) |
| 2210 | (package-vc-update pkg-desc) | ||
| 2211 | (package-delete pkg-desc 'force) | ||
| 2212 | (package-install package 'dont-select)))) | ||
| 2208 | 2213 | ||
| 2209 | (defun package--updateable-packages () | 2214 | (defun package--updateable-packages () |
| 2210 | ;; Initialize the package system to get the list of package | 2215 | ;; Initialize the package system to get the list of package |