From bdf34de11268d11068c9b411c65897717afeb738 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sun, 28 Sep 2014 04:57:05 +0400 Subject: [PATCH] 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. --- company.el | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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. -- 2.39.2