Function: package-menu-filter-by-archive

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

Signature

(package-menu-filter-by-archive ARCHIVE)

Documentation

Filter the "*Packages*" buffer by ARCHIVE.

Display only packages from package archive ARCHIVE.

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

When called from Lisp, ARCHIVE can be a string or a list of strings. If ARCHIVE 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-archive (archive)
  "Filter the \"*Packages*\" buffer by ARCHIVE.
Display only packages from package archive ARCHIVE.

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

When called from Lisp, ARCHIVE can be a string or a list of
strings.  If ARCHIVE is nil or the empty string, show all
packages."
  (interactive (list (completing-read-multiple
                      "Filter by archive (comma separated): "
                      (mapcar #'car package-archives)))
               package-menu-mode)
  (package--ensure-package-menu-mode)
  (let ((re (if (listp archive)
                (regexp-opt archive)
              archive)))
    (package-menu--filter-by (lambda (pkg-desc)
                        (let ((pkg-archive (package-desc-archive pkg-desc)))
                          (and pkg-archive
                               (string-match-p re pkg-archive))))
                      (concat "archive:" (if (listp archive)
                                             (string-join archive ",")
                                           archive)))))