diff options
| author | Artur Malabarba | 2015-04-12 01:52:43 +0100 |
|---|---|---|
| committer | Artur Malabarba | 2015-04-12 01:52:43 +0100 |
| commit | ba273b6185169958df4ce7035e214863d539d48c (patch) | |
| tree | fb807e910d0ca4f2cb017638c772d0687442fc18 | |
| parent | 7cae5c3cb6bcbee49e56c8d607d64071f9196952 (diff) | |
| download | emacs-ba273b6185169958df4ce7035e214863d539d48c.tar.gz emacs-ba273b6185169958df4ce7035e214863d539d48c.zip | |
* lisp/emacs-lisp/package.el: Silence async operations
(package--silence): New variable.
(package--message): New function.
(package-import-keyring, package-refresh-contents)
(package-compute-transaction, package-install, package-delete)
(package-menu--perform-transaction, package-menu-execute): Use it.
| -rw-r--r-- | lisp/emacs-lisp/package.el | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 40d02f8cb63..22575ca472f 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -1343,6 +1343,16 @@ it to the file." | |||
| 1343 | (declare-function epg-configuration "epg-config" ()) | 1343 | (declare-function epg-configuration "epg-config" ()) |
| 1344 | (declare-function epg-import-keys-from-file "epg" (context keys)) | 1344 | (declare-function epg-import-keys-from-file "epg" (context keys)) |
| 1345 | 1345 | ||
| 1346 | (defvar package--silence nil) | ||
| 1347 | |||
| 1348 | (defun package--message (format &rest args) | ||
| 1349 | "Like `message', except sometimes don't print to minibuffer. | ||
| 1350 | If the variable `package--silence' is non-nil, the message is not | ||
| 1351 | displayed on the minibuffer." | ||
| 1352 | (apply #'message format args) | ||
| 1353 | (when package--silence | ||
| 1354 | (message nil))) | ||
| 1355 | |||
| 1346 | ;;;###autoload | 1356 | ;;;###autoload |
| 1347 | (defun package-import-keyring (&optional file) | 1357 | (defun package-import-keyring (&optional file) |
| 1348 | "Import keys from FILE." | 1358 | "Import keys from FILE." |
| @@ -1353,9 +1363,9 @@ it to the file." | |||
| 1353 | (with-file-modes 448 | 1363 | (with-file-modes 448 |
| 1354 | (make-directory homedir t)) | 1364 | (make-directory homedir t)) |
| 1355 | (setf (epg-context-home-directory context) homedir) | 1365 | (setf (epg-context-home-directory context) homedir) |
| 1356 | (message "Importing %s..." (file-name-nondirectory file)) | 1366 | (package--message "Importing %s..." (file-name-nondirectory file)) |
| 1357 | (epg-import-keys-from-file context file) | 1367 | (epg-import-keys-from-file context file) |
| 1358 | (message "Importing %s...done" (file-name-nondirectory file)))) | 1368 | (package--message "Importing %s...done" (file-name-nondirectory file)))) |
| 1359 | 1369 | ||
| 1360 | (defvar package--post-download-archives-hook nil | 1370 | (defvar package--post-download-archives-hook nil |
| 1361 | "Hook run after the archive contents are downloaded. | 1371 | "Hook run after the archive contents are downloaded. |
| @@ -1447,14 +1457,15 @@ downloads in the background." | |||
| 1447 | (unless (file-exists-p package-user-dir) | 1457 | (unless (file-exists-p package-user-dir) |
| 1448 | (make-directory package-user-dir t)) | 1458 | (make-directory package-user-dir t)) |
| 1449 | (let ((default-keyring (expand-file-name "package-keyring.gpg" | 1459 | (let ((default-keyring (expand-file-name "package-keyring.gpg" |
| 1450 | data-directory))) | 1460 | data-directory)) |
| 1461 | (package--silence async)) | ||
| 1451 | (when (and package-check-signature (file-exists-p default-keyring)) | 1462 | (when (and package-check-signature (file-exists-p default-keyring)) |
| 1452 | (condition-case-unless-debug error | 1463 | (condition-case-unless-debug error |
| 1453 | (progn | 1464 | (progn |
| 1454 | (epg-check-configuration (epg-configuration)) | 1465 | (epg-check-configuration (epg-configuration)) |
| 1455 | (package-import-keyring default-keyring)) | 1466 | (package-import-keyring default-keyring)) |
| 1456 | (error (message "Cannot import default keyring: %S" (cdr error)))))) | 1467 | (error (message "Cannot import default keyring: %S" (cdr error))))) |
| 1457 | (package--download-and-read-archives async)) | 1468 | (package--download-and-read-archives async))) |
| 1458 | 1469 | ||
| 1459 | 1470 | ||
| 1460 | ;;; Dependency Management | 1471 | ;;; Dependency Management |
| @@ -1496,7 +1507,7 @@ SEEN is used internally to detect infinite recursion." | |||
| 1496 | ;; we re-add it (along with its dependencies) at an earlier place | 1507 | ;; we re-add it (along with its dependencies) at an earlier place |
| 1497 | ;; below (bug#16994). | 1508 | ;; below (bug#16994). |
| 1498 | (if (memq already seen) ;Avoid inf-loop on dependency cycles. | 1509 | (if (memq already seen) ;Avoid inf-loop on dependency cycles. |
| 1499 | (message "Dependency cycle going through %S" | 1510 | (package--message "Dependency cycle going through %S" |
| 1500 | (package-desc-full-name already)) | 1511 | (package-desc-full-name already)) |
| 1501 | (setq packages (delq already packages)) | 1512 | (setq packages (delq already packages)) |
| 1502 | (setq already nil)) | 1513 | (setq already nil)) |
| @@ -1827,7 +1838,7 @@ to install it but still mark it as selected." | |||
| 1827 | (package-desc-reqs pkg))) | 1838 | (package-desc-reqs pkg))) |
| 1828 | (package-compute-transaction () (list (list pkg)))))) | 1839 | (package-compute-transaction () (list (list pkg)))))) |
| 1829 | (package-download-transaction transaction async callback) | 1840 | (package-download-transaction transaction async callback) |
| 1830 | (message "`%s' is already installed" (package-desc-full-name pkg)))) | 1841 | (package--message "`%s' is already installed" (package-desc-full-name pkg)))) |
| 1831 | 1842 | ||
| 1832 | (defun package-strip-rcs-id (str) | 1843 | (defun package-strip-rcs-id (str) |
| 1833 | "Strip RCS version ID from the version string STR. | 1844 | "Strip RCS version ID from the version string STR. |
| @@ -1970,7 +1981,7 @@ If NOSAVE is non-nil, the package is not removed from | |||
| 1970 | (delete pkg-desc pkgs) | 1981 | (delete pkg-desc pkgs) |
| 1971 | (unless (cdr pkgs) | 1982 | (unless (cdr pkgs) |
| 1972 | (setq package-alist (delq pkgs package-alist)))) | 1983 | (setq package-alist (delq pkgs package-alist)))) |
| 1973 | (message "Package `%s' deleted." (package-desc-full-name pkg-desc)))))) | 1984 | (package--message "Package `%s' deleted." (package-desc-full-name pkg-desc)))))) |
| 1974 | 1985 | ||
| 1975 | ;;;###autoload | 1986 | ;;;###autoload |
| 1976 | (defun package-reinstall (pkg) | 1987 | (defun package-reinstall (pkg) |
| @@ -2771,7 +2782,7 @@ asynchronously." | |||
| 2771 | (error (message (cadr err))))) | 2782 | (error (message (cadr err))))) |
| 2772 | (when package-selected-packages | 2783 | (when package-selected-packages |
| 2773 | (when-let ((removable (package--removable-packages))) | 2784 | (when-let ((removable (package--removable-packages))) |
| 2774 | (message "These %d packages are no longer needed, type `M-x package-autoremove' to remove them (%s)" | 2785 | (package--message "These %d packages are no longer needed, type `M-x package-autoremove' to remove them (%s)" |
| 2775 | (length removable) | 2786 | (length removable) |
| 2776 | (mapconcat #'symbol-name removable ", ")))) | 2787 | (mapconcat #'symbol-name removable ", ")))) |
| 2777 | (package-menu--post-refresh))) | 2788 | (package-menu--post-refresh))) |
| @@ -2801,9 +2812,10 @@ Optional argument NOQUERY non-nil means do not ask the user to confirm." | |||
| 2801 | (user-error "No operations specified")) | 2812 | (user-error "No operations specified")) |
| 2802 | (when (or noquery | 2813 | (when (or noquery |
| 2803 | (package-menu--prompt-transaction-p install-list delete-list)) | 2814 | (package-menu--prompt-transaction-p install-list delete-list)) |
| 2804 | ;; This calls `package-menu--generate' after everything's done. | 2815 | (let ((package--silence package-menu-async)) |
| 2805 | (package-menu--perform-transaction | 2816 | ;; This calls `package-menu--generate' after everything's done. |
| 2806 | install-list delete-list package-menu-async)))) | 2817 | (package-menu--perform-transaction |
| 2818 | install-list delete-list package-menu-async))))) | ||
| 2807 | 2819 | ||
| 2808 | (defun package-menu--version-predicate (A B) | 2820 | (defun package-menu--version-predicate (A B) |
| 2809 | (let ((vA (or (aref (cadr A) 1) '(0))) | 2821 | (let ((vA (or (aref (cadr A) 1) '(0))) |