]> code.delx.au - gnu-emacs-elpa/commitdiff
If there's just one candidate, set company-common to it
authorDmitry Gutov <dgutov@yandex.ru>
Wed, 15 Jan 2014 03:06:21 +0000 (05:06 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Wed, 15 Jan 2014 03:06:21 +0000 (05:06 +0200)
company.el

index 5d1355e0a556129910e2fccef7b442ca85840cdf..ae2ec510ccd31c2077c3badc3b631e75f560efaf 100644 (file)
@@ -833,8 +833,11 @@ can retrieve meta-data for them."
     ;; responsibility of each respective backend, not ours.
     ;; On the other hand, we don't want to replace non-prefix input in
     ;; `company-complete-common'.
-    (setq company-common (company--safe-candidate
-                          (try-completion company-prefix company-candidates)))))
+    (setq company-common
+          (if (cdr company-candidates)
+              (company--safe-candidate
+               (try-completion company-prefix company-candidates))
+            (car company-candidates)))))
 
 (defun company--safe-candidate (str)
   (or (company-call-backend 'crop str)