From: Dmitry Gutov Date: Sun, 28 Sep 2014 00:57:05 +0000 (+0400) Subject: company-create-match-predicate: Just replace the predicate X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/bdf34de11268d11068c9b411c65897717afeb738 company-create-match-predicate: Just replace the predicate Building on the previous one is ridiculous, because the main use case is company-search-mode, and any previous search string is a prefix of the current one. With company-filter-candidates, it was especially wasteful. --- diff --git a/company.el b/company.el index a72136665..8cb12e30c 100644 --- a/company.el +++ b/company.el @@ -1607,13 +1607,9 @@ from the rest of the back-ends in the group, if any, will be left at the end." (company-set-selection (- company-selection pos 1) t)))) (defun company-create-match-predicate () - (setq company-candidates-predicate - `(lambda (candidate) - ,(if company-candidates-predicate - `(and (string-match ,company-search-string candidate) - (funcall ,company-candidates-predicate - candidate)) - `(string-match ,company-search-string candidate)))) + (let ((ss company-search-string)) + (setq company-candidates-predicate + (when ss (lambda (candidate) (string-match ss candidate))))) (company-update-candidates (company-apply-predicate company-candidates company-candidates-predicate)) ;; Invalidate cache.