]> code.delx.au - gnu-emacs-elpa/commitdiff
company-sort-by-occurrence: include words on the same line, too
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 6 May 2014 00:37:58 +0000 (04:37 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 6 May 2014 00:37:58 +0000 (04:37 +0400)
company--begin-new: set company-prefix earlier

Closes #107

company-tests.el
company.el

index abd970423e110c6ca898e554d22edd7f1fa942fe..dba9aa56a544e0f738622677e4772942022f3999 100644 (file)
   (with-temp-buffer
     (company-mode)
     (let (company-frontends
+          company-transformers
           (company-backends (list 'company-async-backend)))
       (company-manual-begin)
       (should (equal "foo" company-prefix))
   (with-temp-buffer
     (company-mode)
     (let (company-frontends
+          company-transformers
           (company-backends (list 'company-async-backend)))
       (company-idle-begin (current-buffer) (selected-window)
                           (buffer-chars-modified-tick) (point))
       (should (null company-candidates))
       (insert "a")
       (sleep-for 0.1)
-      (should (null company-prefix))
       (should (null company-candidates)))))
 
 (ert-deftest company-idle-begin-async-allows-immediate-callbacks ()
index d4f284e3dddbbca3530f0d71817901485176ac99..ee030e2c1385a2a6cf4db4f498cca323c0edf139 100644 (file)
@@ -1176,7 +1176,7 @@ Keywords and function definition names are ignored."
            (lambda (candidate)
              (when (or
                     (save-excursion
-                      (progn (forward-line 0)
+                      (progn (forward-char (- (length company-prefix)))
                              (search-backward candidate (window-start) t)))
                     (save-excursion
                       (search-forward candidate (window-end) t)))
@@ -1354,14 +1354,13 @@ Keywords and function definition names are ignored."
               (company--multi-backend-adapter backend 'prefix)))
       (when prefix
         (when (company--good-prefix-p prefix)
-          (setq prefix (or (car-safe prefix) prefix)
+          (setq company-prefix (or (car-safe prefix) prefix)
                 company-backend backend
-                c (company-calculate-candidates prefix))
+                c (company-calculate-candidates company-prefix))
           ;; t means complete/unique.  We don't start, so no hooks.
           (if (not (consp c))
               (when company--manual-action
                 (message "No completion found"))
-            (setq company-prefix prefix)
             (when company--manual-action
               (setq company--manual-prefix prefix))
             (when (symbolp backend)