]> code.delx.au - gnu-emacs-elpa/commitdiff
Extracted company--good-prefix-p.
authorNikolaj Schumacher <git@nschum.de>
Tue, 21 Apr 2009 21:21:23 +0000 (23:21 +0200)
committerNikolaj Schumacher <git@nschum.de>
Thu, 23 Apr 2009 14:13:44 +0000 (16:13 +0200)
company.el

index bb2131b329b8188f9c5418f24737ac6b6376a366..7b51e4f77c4ca725c3342ad92923f8502fc003a2 100644 (file)
@@ -909,15 +909,17 @@ keymap during active completions (`company-active-map'):
         (company-cancel company-prefix)
         nil)))))
 
+(defun company--good-prefix-p (prefix)
+  (and (stringp prefix)
+       (or (company-explicit-action-p)
+           (>= (length prefix) company-minimum-prefix-length))))
+
 (defun company--continue ()
   (when (company-call-backend 'no-cache company-prefix)
     ;; Don't complete existing candidates, fetch new ones.
     (setq company-candidates-cache nil))
   (let* ((new-prefix (company-call-backend 'prefix))
-         (c (when (and (stringp new-prefix)
-                       (or (company-explicit-action-p)
-                           (>= (length new-prefix)
-                               company-minimum-prefix-length))
+         (c (when (and (company--good-prefix-p new-prefix)
                        (= (- (point) (length new-prefix))
                           (- company-point (length company-prefix))))
               (company-calculate-candidates new-prefix))))
@@ -950,8 +952,7 @@ keymap during active completions (`company-active-map'):
                   (funcall backend 'prefix))
               (company--multi-backend-adapter backend 'prefix)))
       (when prefix
-        (when (and (stringp prefix)
-                   (>= (length prefix) company-minimum-prefix-length))
+        (when (company--good-prefix-p prefix)
           (setq company-backend backend
                 c (company-calculate-candidates prefix))
           ;; t means complete/unique.  We don't start, so no hooks.