emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] 09/52: company-sort-by-occurrence: include words on the same line


From: Dmitry Gutov
Subject: [elpa] 09/52: company-sort-by-occurrence: include words on the same line, too
Date: Tue, 01 Jul 2014 11:53:07 +0000

dgutov pushed a commit to branch master
in repository elpa.

commit d10cb4f89d0f59efd99881b59c5fde97ebdff912
Author: Dmitry Gutov <address@hidden>
Date:   Tue May 6 04:37:58 2014 +0400

    company-sort-by-occurrence: include words on the same line, too
    
    company--begin-new: set company-prefix earlier
    
    Closes #107
---
 company-tests.el |    3 ++-
 company.el       |    7 +++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/company-tests.el b/company-tests.el
index abd9704..dba9aa5 100644
--- a/company-tests.el
+++ b/company-tests.el
@@ -548,6 +548,7 @@
   (with-temp-buffer
     (company-mode)
     (let (company-frontends
+          company-transformers
           (company-backends (list 'company-async-backend)))
       (company-manual-begin)
       (should (equal "foo" company-prefix))
@@ -557,6 +558,7 @@
   (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))
@@ -575,7 +577,6 @@
       (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 ()
diff --git a/company.el b/company.el
index d4f284e..ee030e2 100644
--- a/company.el
+++ b/company.el
@@ -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)



reply via email to

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