Function: ecomplete-get-matches

ecomplete-get-matches is a byte-compiled function defined in ecomplete.el.gz.

Signature

(ecomplete-get-matches TYPE MATCH)

Source Code

;; Defined in /usr/src/emacs/lisp/ecomplete.el.gz
(defun ecomplete-get-matches (type match)
  (let* ((elems (cdr (assq type ecomplete-database)))
	 (match (regexp-quote match))
	 (candidates
	  (sort
	   (cl-loop for (_key count time text) in elems
		    when (string-match match text)
		    collect (list count time text))
           ecomplete-sort-predicate)))
    (when (> (length candidates) 10)
      (setcdr (nthcdr 10 candidates) nil))
    (unless (zerop (length candidates))
      (with-temp-buffer
	(dolist (candidate candidates)
	  (insert (caddr candidate) "\n"))
	(goto-char (point-min))
	(put-text-property (point) (1+ (point)) 'ecomplete t)
	(while (re-search-forward match nil t)
	  (put-text-property (match-beginning 0) (match-end 0)
			     'face 'isearch))
	(buffer-string)))))