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-set-selection (- company-selection pos 1) t))))
(defun company-create-match-predicate ()
(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.
(company-update-candidates
(company-apply-predicate company-candidates company-candidates-predicate))
;; Invalidate cache.