]> code.delx.au - gnu-emacs-elpa/commitdiff
More robust and simpler logic in prefix test
authorIngo Lohmar <i.lohmar@gmail.com>
Tue, 25 Mar 2014 21:41:49 +0000 (22:41 +0100)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 25 Mar 2014 22:29:57 +0000 (00:29 +0200)
company.el

index 704b83bf0f67b9f953c754d64c230a314c4dda1b..7f327d4b22b4405cc7cd3034cfe5c5f76bc6cb6a 100644 (file)
@@ -1198,18 +1198,17 @@ Keywords and function definition names are ignored."
      (t (company-cancel)))))
 
 (defun company--good-prefix-p (prefix)
-  (and (or (and company--manual-prefix
+  (and (stringp (or (car-safe prefix) prefix)) ;excludes 'stop
+       (or (and company--manual-prefix
                 ;; changed selection not enough for valid prefix
                 (not (and company-abort-manual-when-too-short
                           ;; must not be less than minimum or initial length
                           (< (or (cdr-safe prefix) (length prefix))
                              (min company-minimum-prefix-length
                                   (length company--manual-prefix))))))
-           (unless (eq prefix 'stop)
-             (or (eq (cdr-safe prefix) t)
-                 (>= (or (cdr-safe prefix) (length prefix))
-                     company-minimum-prefix-length))))
-       (stringp (or (car-safe prefix) prefix))))
+           (or (eq (cdr-safe prefix) t)
+               (>= (or (cdr-safe prefix) (length prefix))
+                   company-minimum-prefix-length)))))
 
 (defun company--continue ()
   (when (company-call-backend 'no-cache company-prefix)