Function: completion-flex-all-completions

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

Signature

(completion-flex-all-completions STRING TABLE PRED POINT)

Documentation

Get flex-completions of STRING in TABLE, given PRED and POINT.

Source Code

;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
(cl-defun completion-flex-all-completions (string table pred point)
  "Get flex-completions of STRING in TABLE, given PRED and POINT."
  (when (and completion-flex-nospace (string-search " " string))
    (cl-return-from completion-flex-all-completions))
  (pcase-let ((`(,all ,pattern-str ,prefix ,_suffix)
               (completion--flex-all-completions-1 string table pred point)))
    (setq completion-lazy-hilit-fn
          (lambda (str)
            (when-let* ((matches (get-text-property 0 'flex-matches str)))
              (dolist (pos matches)
                (add-face-text-property pos (1+ pos)
                                        'completions-common-part
                                        nil str))
              (let ((special-match (nth (1- (- point (length prefix))) matches)))
                (when (and special-match (> (length str) (1+ special-match)))
                  (add-face-text-property
                   (1+ special-match) (+ 2 special-match)
                   'completions-first-difference nil str))))
            str))
    (unless completion-lazy-hilit
      (setq all (mapcar completion-lazy-hilit-fn all)))
    ;; Store pattern for adjust-metadata to use
    (setq completion-flex--pattern-str pattern-str)
    ;; Return completions with base-size
    (and all (if (string= prefix "") all (nconc all (length prefix))))))