[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 07/30: company-create-match-predicate: Just replace the predicate

From: Dmitry Gutov
Subject: [elpa] 07/30: company-create-match-predicate: Just replace the predicate
Date: Tue, 14 Oct 2014 22:22:46 +0000

dgutov pushed a commit to branch master
in repository elpa.

commit bdf34de11268d11068c9b411c65897717afeb738
Author: Dmitry Gutov <address@hidden>
Date:   Sun Sep 28 04:57:05 2014 +0400

    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 
    one.  With company-filter-candidates, it was especially wasteful.
 company.el |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/company.el b/company.el
index a721366..8cb12e3 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-apply-predicate company-candidates company-candidates-predicate))
   ;; Invalidate cache.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]