- (company-search-assert-enabled)
- (let* ((ss (concat company-search-string (string last-command-event)))
- (pos (company-search ss (nthcdr company-selection company-candidates))))
+ (company--search-assert-enabled)
+ (let ((ss (concat company-search-string (string last-command-event))))
+ (when company-search-filtering
+ (company--search-update-predicate ss))
+ (company--search-update-string ss)))
+
+(defun company--search-update-predicate (&optional ss)
+ (let* ((company-candidates-predicate
+ (and (not (string= ss ""))
+ company-search-filtering
+ (lambda (candidate) (string-match ss candidate))))
+ (cc (company-calculate-candidates company-prefix)))
+ (unless cc (error "No match"))
+ (company-update-candidates cc)))
+
+(defun company--search-update-string (new)
+ (let* ((pos (company--search new (nthcdr company-selection company-candidates))))