]> code.delx.au - gnu-emacs-elpa/commitdiff
company-capf: Distinguish between `finished' and `exact' in post-completion
authorDmitry Gutov <dgutov@yandex.ru>
Wed, 5 Nov 2014 07:44:12 +0000 (09:44 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Wed, 5 Nov 2014 07:44:12 +0000 (09:44 +0200)
Fixes #217

company-capf.el

index b630025690f498063f554fb75463d2c07fa0f678..1a0e9ec52e5bf98833ab88412323261ac4f85ffa 100644 (file)
     (`init nil)      ;Don't bother: plenty of other ways to initialize the code.
     (`post-completion
      (let* ((res (company--capf-data))
-            (exit-function (plist-get (nthcdr 4 res) :exit-function)))
+            (exit-function (plist-get (nthcdr 4 res) :exit-function))
+            (table (nth 3 res))
+            (pred (plist-get (nthcdr 4 res) :predicate)))
        (if exit-function
-           (funcall exit-function arg 'finished))))
+           ;; Follow the example of `completion--done'.
+           (funcall exit-function arg
+                    (if (eq (try-completion arg table pred) t)
+                        'finished 'exact)))))
     ))
 
 (provide 'company-capf)