diff options
| author | Artur Malabarba | 2015-04-05 23:21:26 +0100 |
|---|---|---|
| committer | Artur Malabarba | 2015-04-06 11:19:04 +0100 |
| commit | 6701726b98261f862e4708aadb6d518b886cf8e2 (patch) | |
| tree | 5e637b9b9324df7570c0b9a4a59d71d2ef14db23 | |
| parent | b6610d55470c7e835472a581977ab6fad537c8b6 (diff) | |
| download | emacs-6701726b98261f862e4708aadb6d518b886cf8e2.tar.gz emacs-6701726b98261f862e4708aadb6d518b886cf8e2.zip | |
emacs-lisp/package.el (package-install): Add ASYNC and CALLBACK
| -rw-r--r-- | lisp/ChangeLog | 1 | ||||
| -rw-r--r-- | lisp/emacs-lisp/package.el | 22 |
2 files changed, 13 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8f51db64f35..07e95429375 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -87,6 +87,7 @@ | |||
| 87 | (package-menu--prompt-transaction-p): New function. | 87 | (package-menu--prompt-transaction-p): New function. |
| 88 | (package-menu-execute): Use it to prompt the user about operations | 88 | (package-menu-execute): Use it to prompt the user about operations |
| 89 | to be executed. | 89 | to be executed. |
| 90 | (package-install): Add ASYNC and CALLBACK arguments. | ||
| 90 | 91 | ||
| 91 | 2015-04-05 Pete Williamson <petewil@chromium.org> (tiny-change) | 92 | 2015-04-05 Pete Williamson <petewil@chromium.org> (tiny-change) |
| 92 | 93 | ||
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index e7c33db7528..6d5d46c14bb 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -1773,13 +1773,16 @@ using `package-compute-transaction'." | |||
| 1773 | (kill-buffer (current-buffer))))))))) | 1773 | (kill-buffer (current-buffer))))))))) |
| 1774 | 1774 | ||
| 1775 | ;;;###autoload | 1775 | ;;;###autoload |
| 1776 | (defun package-install (pkg &optional dont-select) | 1776 | (defun package-install (pkg &optional dont-select async callback) |
| 1777 | "Install the package PKG. | 1777 | "Install the package PKG. |
| 1778 | PKG can be a package-desc or the package name of one the available packages | 1778 | PKG can be a package-desc or the package name of one the available packages |
| 1779 | in an archive in `package-archives'. Interactively, prompt for its name. | 1779 | in an archive in `package-archives'. Interactively, prompt for its name. |
| 1780 | 1780 | ||
| 1781 | If called interactively or if DONT-SELECT nil, add PKG to | 1781 | If called interactively or if DONT-SELECT nil, add PKG to |
| 1782 | `package-selected-packages'. | 1782 | `package-selected-packages'. |
| 1783 | If ASYNC is non-nil, perform the downloads asynchronously. | ||
| 1784 | If CALLBACK is non-nil, call it with no arguments once the | ||
| 1785 | entire operation is done. | ||
| 1783 | 1786 | ||
| 1784 | If PKG is a package-desc and it is already installed, don't try | 1787 | If PKG is a package-desc and it is already installed, don't try |
| 1785 | to install it but still mark it as selected." | 1788 | to install it but still mark it as selected." |
| @@ -1807,15 +1810,14 @@ to install it but still mark it as selected." | |||
| 1807 | (unless (or dont-select (package--user-selected-p name)) | 1810 | (unless (or dont-select (package--user-selected-p name)) |
| 1808 | (customize-save-variable 'package-selected-packages | 1811 | (customize-save-variable 'package-selected-packages |
| 1809 | (cons name package-selected-packages)))) | 1812 | (cons name package-selected-packages)))) |
| 1810 | (if (package-desc-p pkg) | 1813 | (if-let ((transaction |
| 1811 | (if (package-installed-p pkg) | 1814 | (if (package-desc-p pkg) |
| 1812 | (message "`%s' is already installed" (package-desc-full-name pkg)) | 1815 | (unless (package-installed-p pkg) |
| 1813 | (package-download-transaction | 1816 | (package-compute-transaction (list pkg) |
| 1814 | (package-compute-transaction (list pkg) | 1817 | (package-desc-reqs pkg))) |
| 1815 | (package-desc-reqs pkg)))) | 1818 | (package-compute-transaction () (list (list pkg)))))) |
| 1816 | (package-download-transaction | 1819 | (package-download-transaction transaction async callback) |
| 1817 | (package-compute-transaction () | 1820 | (message "`%s' is already installed" (package-desc-full-name pkg)))) |
| 1818 | (list (list pkg)))))) | ||
| 1819 | 1821 | ||
| 1820 | (defun package-strip-rcs-id (str) | 1822 | (defun package-strip-rcs-id (str) |
| 1821 | "Strip RCS version ID from the version string STR. | 1823 | "Strip RCS version ID from the version string STR. |