Function: completion--flex-score

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

Signature

(completion--flex-score STR RE &optional DONT-ERROR)

Documentation

Compute flex score of completion STR based on RE.

If DONT-ERROR, just return nil if RE doesn't match STR.

Source Code

;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
(defun completion--flex-score (str re &optional dont-error)
  "Compute flex score of completion STR based on RE.
If DONT-ERROR, just return nil if RE doesn't match STR."
  (let ((case-fold-search completion-ignore-case))
    (cond ((string-match re str)
           (let* ((match-end (match-end 0))
                  (md (cddr
                       (setq
                        completion--flex-score-last-md
                        (match-data t completion--flex-score-last-md)))))
             (completion--flex-score-1 md match-end (length str))))
          ((not dont-error)
           (error "Internal error: %s does not match %s" re str)))))