Function: completion--flex-all-completions-1

completion--flex-all-completions-1 is a byte-compiled function defined in minibuffer.el.gz.

Signature

(completion--flex-all-completions-1 PAT TABLE PRED POINT)

Documentation

Filters completions TABLE by PAT, "flex" string. PRED and POINT as usual. Returns (ALL PAT PREFIX SUFFIX).

Source Code

;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
(defun completion--flex-all-completions-1 (pat table pred point)
  "Filters completions TABLE by PAT, \"flex\" string. PRED and POINT as
usual. Returns (ALL PAT PREFIX SUFFIX)."
  (let* ((beforepoint (substring pat 0 point))
         (afterpoint (substring pat point))
         (bounds (completion-boundaries beforepoint table pred afterpoint))
         (prefix (substring beforepoint 0 (car bounds)))
         (suffix (substring afterpoint (cdr bounds)))
         (pat2 (substring pat (car bounds) (+ point (cdr bounds))))
         (all (all-completions prefix table pred))
         (all
          (if (zerop (length pat2)) all
            (cl-loop
             for c in all
             for c2 = (or (get-text-property 0 'completion--unquoted c) c)
             for (cost . matches) = (completion--flex-cost pat2 c2 t)
             when cost
             collect (propertize
                      c2 'flex-cost cost 'flex-matches matches)))))
    (list all pat2 prefix suffix)))