Function: package-menu-filter-by-status

package-menu-filter-by-status is an interactive and byte-compiled function defined in package.el.gz.

Signature

(package-menu-filter-by-status STATUS)

Documentation

Filter the "*Packages*" buffer by STATUS.

Display only packages with specified STATUS.

When called interactively, prompt for STATUS, which can be a comma-separated string. If STATUS is empty, show all packages.

When called from Lisp, STATUS can be a string or a list of strings. If STATUS is nil or the empty string, show all packages.

Probably introduced at or before Emacs version 28.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
(defun package-menu-filter-by-status (status)
  "Filter the \"*Packages*\" buffer by STATUS.
Display only packages with specified STATUS.

When called interactively, prompt for STATUS, which can be a
comma-separated string.  If STATUS is empty, show all packages.

When called from Lisp, STATUS can be a string or a list of
strings.  If STATUS is nil or the empty string, show all
packages."
  (interactive (list (completing-read "Filter by status: "
                                      '("avail-obso"
                                        "available"
                                        "built-in"
                                        "dependency"
                                        "disabled"
                                        "external"
                                        "held"
                                        "incompat"
                                        "installed"
                                        "new"
                                        "unsigned")))
               package-menu-mode)
  (package--ensure-package-menu-mode)
  (if (or (not status) (string-empty-p status))
      (package-menu--generate t t)
    (let ((status-list
           (if (listp status)
               status
             (split-string status ","))))
      (package-menu--filter-by
       (lambda (pkg-desc)
         (member (package-desc-status pkg-desc) status-list))
       (format "status:%s" (string-join status-list ","))))))