Function: package-menu-filter-by-keyword

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

Signature

(package-menu-filter-by-keyword KEYWORD)

Documentation

Filter the "*Packages*" buffer by KEYWORD.

Display only packages whose keywords match the specified KEYWORD. KEYWORD can be a string or a list of strings. If KEYWORD is nil or the empty string, show all packages.

In addition to package keywords, KEYWORD can include the name(s) of archive(s) and the package status, such as "available" or "built-in" or "obsolete".

When called interactively, prompt for KEYWORD. To specify several keywords, type them separated by commas.

View in manual

Probably introduced at or before Emacs version 27.1.

Key Bindings

Aliases

package-menu-filter (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
(defun package-menu-filter-by-keyword (keyword)
  "Filter the \"*Packages*\" buffer by KEYWORD.
Display only packages whose keywords match the specified KEYWORD.
KEYWORD can be a string or a list of strings.  If KEYWORD is nil
or the empty string, show all packages.

In addition to package keywords, KEYWORD can include the name(s)
of archive(s) and the package status, such as \"available\"
or \"built-in\" or \"obsolete\".

When called interactively, prompt for KEYWORD.  To specify several
keywords, type them separated by commas."
  (interactive (list (completing-read-multiple
                      "Keywords: "
                      (package-all-keywords)))
               package-menu-mode)
  (package--ensure-package-menu-mode)
  (when (stringp keyword)
    (setq keyword (list keyword)))
  (if (not keyword)
      (package-menu--generate t t)
    (package-menu--filter-by (lambda (pkg-desc)
                        (package--has-keyword-p pkg-desc keyword))
                      (concat "keyword:" (string-join keyword ",")))))