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
(package--user-selected-p, package-install-from-buffer)
(package-delete, package-install): Use it.

(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."
(let* ((auto-name (format "%s-autoloads.el" name))
;;(ignore-name (concat name "-pkg.el"))
(generated-autoload-file (expand-file-name auto-name pkg-dir))
;; Silence `autoload-generate-file-autoloads'.
(noninteractive package--silence)
(backup-inhibited t)
(version-control 'never))
(package-autoload-ensure-default-file generated-autoload-file)
......@@ -1573,15 +1575,20 @@ Used to populate `package-selected-packages'."
unless (memq name dep-list)
collect name)))
(defun package--save-selected-packages (value)
"Set and save `package-selected-packages' to VALUE."
(let ((save-silently package--silence))
(setq package-selected-packages value))))
(defun package--user-selected-p (pkg)
"Return non-nil if PKG is a package was installed by the user.
PKG is a package name.
This looks into `package-selected-packages', populating it first
if it is still empty."
(unless (consp package-selected-packages)
(setq package-selected-packages (package--find-non-dependencies))))
(package--save-selected-packages (package--find-non-dependencies)))
(memq pkg package-selected-packages))
(defun package--get-deps (pkg &optional only)
......@@ -1691,7 +1698,8 @@ operation is done."
;; If we don't care about the signature, unpack and we're
;; done.
(progn (package-unpack pkg-desc)
(progn (let ((save-silently async))
(package-unpack pkg-desc))
(funcall callback))
;; If we care, check it and *then* write the file.
(let ((content (buffer-string)))
......@@ -1706,7 +1714,8 @@ operation is done."
(package-desc-name pkg-desc)))
;; Signature checked, unpack now.
(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
;; signed if appropriate.
(when good-sigs
......@@ -1833,7 +1842,7 @@ to install it but still mark it as selected."
(package-desc-name pkg)
(unless (or dont-select (package--user-selected-p name))
(customize-save-variable 'package-selected-packages
(cons name package-selected-packages))))
(if-let ((transaction
(if (package-desc-p pkg)
......@@ -1891,7 +1900,7 @@ Downloads and installs required packages as needed."
;; Install the package itself.
(package-unpack pkg-desc)
(unless (package--user-selected-p name)
(customize-save-variable 'package-selected-packages
(cons name package-selected-packages)))
......@@ -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
;; upgraded package.
(package--newest-p pkg-desc))
'package-selected-packages (remove name package-selected-packages)))
(package--save-selected-packages (remove name package-selected-packages)))
(cond ((not (string-prefix-p (file-name-as-directory
(expand-file-name package-user-dir))
(expand-file-name dir)))
......@@ -2802,6 +2810,7 @@ asynchronously."
(lambda () (package-menu--perform-transaction rest delete-list async))))
;; Once there are no more packages to install, proceed to
;; deletion.
(let ((package--silence async))
(dolist (elt (package--sort-by-dependence delete-list))
(condition-case-unless-debug err
(package-delete elt)
......@@ -2810,7 +2819,8 @@ asynchronously."
(when-let ((removable (package--removable-packages)))
(package--message "These %d packages are no longer needed, type `M-x package-autoremove' to remove them (%s)"
(length removable)
(mapconcat #'symbol-name removable ", "))))
(mapconcat #'symbol-name removable ", ")))))
(message "Transaction done")
(defun package-menu-execute (&optional noquery)
......@@ -2838,10 +2848,10 @@ Optional argument NOQUERY non-nil means do not ask the user to confirm."
(user-error "No operations specified"))
(when (or noquery
(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.
install-list delete-list package-menu-async)))))
install-list delete-list package-menu-async))))
(defun package-menu--version-predicate (A B)
(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