Function: consult--completion-filter

consult--completion-filter is a byte-compiled function defined in consult.el.

Signature

(consult--completion-filter PATTERN CANDS CATEGORY HIGHLIGHT)

Documentation

Filter CANDS with PATTERN.

CATEGORY is the completion category, used to find the completion style via completion-category-defaults and completion-category-overrides. HIGHLIGHT must be non-nil if the resulting strings should be highlighted.

Source Code

;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
(defun consult--completion-filter (pattern cands category highlight)
  "Filter CANDS with PATTERN.

CATEGORY is the completion category, used to find the completion style via
`completion-category-defaults' and `completion-category-overrides'.
HIGHLIGHT must be non-nil if the resulting strings should be highlighted."
  ;; Ensure that the global completion style settings are used for
  ;; `consult-line', `consult-focus-lines' and `consult-keep-lines' filtering.
  ;; This override is necessary since users may want to override the settings
  ;; buffer-locally for in-buffer completion via Corfu.
  (dlet ((completion-lazy-hilit (not highlight))
         (completion-styles (default-value 'completion-styles))
         (completion-category-defaults (default-value 'completion-category-defaults))
         (completion-category-overrides (default-value 'completion-category-overrides)))
    ;; `completion-all-completions' returns an improper list where the last link
    ;; is not necessarily nil.
    (nconc (completion-all-completions pattern cands nil (length pattern)
                                       `(metadata (category . ,category)))
           nil)))