Function: package-autoremove
package-autoremove is an autoloaded, interactive and byte-compiled
function defined in package.el.gz.
Signature
(package-autoremove &optional NOCONFIRM)
Documentation
Remove packages that are no longer needed.
Packages that are no more needed by other packages in
package-selected-packages and their dependencies
will be deleted.
If optional argument NOCONFIRM is non-nil, or when invoked with a prefix argument, don't ask for confirmation to install packages.
Probably introduced at or before Emacs version 25.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
;;;###autoload
(defun package-autoremove (&optional noconfirm)
"Remove packages that are no longer needed.
Packages that are no more needed by other packages in
`package-selected-packages' and their dependencies
will be deleted.
If optional argument NOCONFIRM is non-nil, or when invoked with a prefix
argument, don't ask for confirmation to install packages."
(interactive "P")
;; If `package-selected-packages' is nil, it would make no sense to
;; try to populate it here, because then `package-autoremove' will
;; do absolutely nothing.
(when (or noconfirm
package-selected-packages
(yes-or-no-p
(format-message
"`package-selected-packages' is empty! Really remove ALL packages? ")))
(let ((removable (package--removable-packages)))
(if removable
(when (or noconfirm
(y-or-n-p
(format "Packages to delete: %d (%s), proceed? "
(length removable)
(mapconcat #'symbol-name removable " "))))
(mapc (lambda (p)
(package-delete (cadr (assq p package-alist)) t))
removable))
(message "Nothing to autoremove")))))