Commit 5aa0dfe4 authored by Artur Malabarba's avatar Artur Malabarba

* lisp/emacs-lisp/package.el: Completely silence async operations

(package--make-autoloads-and-stuff): Silence autoloads.

(package--save-selected-packages): New function, silences
`customize-save-variable'.
(package--user-selected-p, package-install-from-buffer)
(package-delete, package-install): Use it.

(package-install-from-archive)
(package-menu--perform-transaction): Silence.

(package-menu-execute): Feedback when operation starts.
parent dfdd7e19
...@@ -866,6 +866,8 @@ untar into a directory named DIR; otherwise, signal an error." ...@@ -866,6 +866,8 @@ untar into a directory named DIR; otherwise, signal an error."
(let* ((auto-name (format "%s-autoloads.el" name)) (let* ((auto-name (format "%s-autoloads.el" name))
;;(ignore-name (concat name "-pkg.el")) ;;(ignore-name (concat name "-pkg.el"))
(generated-autoload-file (expand-file-name auto-name pkg-dir)) (generated-autoload-file (expand-file-name auto-name pkg-dir))
;; Silence `autoload-generate-file-autoloads'.
(noninteractive package--silence)
(backup-inhibited t) (backup-inhibited t)
(version-control 'never)) (version-control 'never))
(package-autoload-ensure-default-file generated-autoload-file) (package-autoload-ensure-default-file generated-autoload-file)
...@@ -1573,15 +1575,20 @@ Used to populate `package-selected-packages'." ...@@ -1573,15 +1575,20 @@ Used to populate `package-selected-packages'."
unless (memq name dep-list) unless (memq name dep-list)
collect name))) collect name)))
(defun package--save-selected-packages (value)
"Set and save `package-selected-packages' to VALUE."
(let ((save-silently package--silence))
(customize-save-variable
'package-selected-packages
(setq package-selected-packages value))))
(defun package--user-selected-p (pkg) (defun package--user-selected-p (pkg)
"Return non-nil if PKG is a package was installed by the user. "Return non-nil if PKG is a package was installed by the user.
PKG is a package name. PKG is a package name.
This looks into `package-selected-packages', populating it first This looks into `package-selected-packages', populating it first
if it is still empty." if it is still empty."
(unless (consp package-selected-packages) (unless (consp package-selected-packages)
(customize-save-variable (package--save-selected-packages (package--find-non-dependencies)))
'package-selected-packages
(setq package-selected-packages (package--find-non-dependencies))))
(memq pkg package-selected-packages)) (memq pkg package-selected-packages))
(defun package--get-deps (pkg &optional only) (defun package--get-deps (pkg &optional only)
...@@ -1691,7 +1698,8 @@ operation is done." ...@@ -1691,7 +1698,8 @@ operation is done."
package-unsigned-archives)) package-unsigned-archives))
;; If we don't care about the signature, unpack and we're ;; If we don't care about the signature, unpack and we're
;; done. ;; done.
(progn (package-unpack pkg-desc) (progn (let ((save-silently async))
(package-unpack pkg-desc))
(funcall callback)) (funcall callback))
;; If we care, check it and *then* write the file. ;; If we care, check it and *then* write the file.
(let ((content (buffer-string))) (let ((content (buffer-string)))
...@@ -1706,7 +1714,8 @@ operation is done." ...@@ -1706,7 +1714,8 @@ operation is done."
(package-desc-name pkg-desc))) (package-desc-name pkg-desc)))
;; Signature checked, unpack now. ;; Signature checked, unpack now.
(with-temp-buffer (insert content) (with-temp-buffer (insert content)
(package-unpack pkg-desc)) (let ((save-silently async))
(package-unpack pkg-desc)))
;; Here the package has been installed successfully, mark it as ;; Here the package has been installed successfully, mark it as
;; signed if appropriate. ;; signed if appropriate.
(when good-sigs (when good-sigs
...@@ -1833,8 +1842,8 @@ to install it but still mark it as selected." ...@@ -1833,8 +1842,8 @@ to install it but still mark it as selected."
(package-desc-name pkg) (package-desc-name pkg)
pkg))) pkg)))
(unless (or dont-select (package--user-selected-p name)) (unless (or dont-select (package--user-selected-p name))
(customize-save-variable 'package-selected-packages (package--save-selected-packages
(cons name package-selected-packages)))) (cons name package-selected-packages))))
(if-let ((transaction (if-let ((transaction
(if (package-desc-p pkg) (if (package-desc-p pkg)
(unless (package-installed-p pkg) (unless (package-installed-p pkg)
...@@ -1891,8 +1900,8 @@ Downloads and installs required packages as needed." ...@@ -1891,8 +1900,8 @@ Downloads and installs required packages as needed."
;; Install the package itself. ;; Install the package itself.
(package-unpack pkg-desc) (package-unpack pkg-desc)
(unless (package--user-selected-p name) (unless (package--user-selected-p name)
(customize-save-variable 'package-selected-packages (package--save-selected-packages
(cons name package-selected-packages))) (cons name package-selected-packages)))
pkg-desc)) pkg-desc))
;;;###autoload ;;;###autoload
...@@ -1959,8 +1968,7 @@ If NOSAVE is non-nil, the package is not removed from ...@@ -1959,8 +1968,7 @@ If NOSAVE is non-nil, the package is not removed from
;; Don't deselect if this is an older version of an ;; Don't deselect if this is an older version of an
;; upgraded package. ;; upgraded package.
(package--newest-p pkg-desc)) (package--newest-p pkg-desc))
(customize-save-variable (package--save-selected-packages (remove name package-selected-packages)))
'package-selected-packages (remove name package-selected-packages)))
(cond ((not (string-prefix-p (file-name-as-directory (cond ((not (string-prefix-p (file-name-as-directory
(expand-file-name package-user-dir)) (expand-file-name package-user-dir))
(expand-file-name dir))) (expand-file-name dir)))
...@@ -2802,15 +2810,17 @@ asynchronously." ...@@ -2802,15 +2810,17 @@ asynchronously."
(lambda () (package-menu--perform-transaction rest delete-list async)))) (lambda () (package-menu--perform-transaction rest delete-list async))))
;; Once there are no more packages to install, proceed to ;; Once there are no more packages to install, proceed to
;; deletion. ;; deletion.
(dolist (elt (package--sort-by-dependence delete-list)) (let ((package--silence async))
(condition-case-unless-debug err (dolist (elt (package--sort-by-dependence delete-list))
(package-delete elt) (condition-case-unless-debug err
(error (message (cadr err))))) (package-delete elt)
(when package-selected-packages (error (message (cadr err)))))
(when-let ((removable (package--removable-packages))) (when package-selected-packages
(package--message "These %d packages are no longer needed, type `M-x package-autoremove' to remove them (%s)" (when-let ((removable (package--removable-packages)))
(length removable) (package--message "These %d packages are no longer needed, type `M-x package-autoremove' to remove them (%s)"
(mapconcat #'symbol-name removable ", ")))) (length removable)
(mapconcat #'symbol-name removable ", ")))))
(message "Transaction done")
(package-menu--post-refresh))) (package-menu--post-refresh)))
(defun package-menu-execute (&optional noquery) (defun package-menu-execute (&optional noquery)
...@@ -2838,10 +2848,10 @@ Optional argument NOQUERY non-nil means do not ask the user to confirm." ...@@ -2838,10 +2848,10 @@ Optional argument NOQUERY non-nil means do not ask the user to confirm."
(user-error "No operations specified")) (user-error "No operations specified"))
(when (or noquery (when (or noquery
(package-menu--prompt-transaction-p install-list delete-list)) (package-menu--prompt-transaction-p install-list delete-list))
(let ((package--silence package-menu-async)) (message "Transaction started")
;; This calls `package-menu--generate' after everything's done. ;; This calls `package-menu--generate' after everything's done.
(package-menu--perform-transaction (package-menu--perform-transaction
install-list delete-list package-menu-async))))) install-list delete-list package-menu-async))))
(defun package-menu--version-predicate (A B) (defun package-menu--version-predicate (A B)
(let ((vA (or (aref (cadr A) 1) '(0))) (let ((vA (or (aref (cadr A) 1) '(0)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment