]> rtime.felk.cvut.cz Git - sojka/company-mode.git/commitdiff
Use timer slightly more efficiently.
authorNikolaj Schumacher <git@nschum.de>
Sun, 19 Apr 2009 10:56:03 +0000 (12:56 +0200)
committerNikolaj Schumacher <git@nschum.de>
Sun, 19 Apr 2009 11:31:35 +0000 (13:31 +0200)
company.el

index c45dde079d9ecd4c0bd276f8db81618412d704c2..21de5612519af0cef63a90e01eb82f8ae932f4ff 100644 (file)
@@ -998,7 +998,8 @@ keymap during active completions (`company-active-map'):
              (message "%s" (error-message-string err))
              (company-cancel))))
   (when company-timer
-    (cancel-timer company-timer))
+    (cancel-timer company-timer)
+    (setq company-timer nil))
   (company-uninstall-map))
 
 (defun company-post-command ()
@@ -1007,15 +1008,16 @@ keymap during active completions (`company-active-map'):
         (progn
           (unless (equal (point) company-point)
             (company-begin))
-          (when company-candidates
-            (company-call-frontends 'post-command))
-          (and (numberp company-idle-delay)
-               (or (eq t company-begin-commands)
-                   (memq this-command company-begin-commands))
-               (setq company-timer
-                     (run-with-timer company-idle-delay nil 'company-idle-begin
-                                     (current-buffer) (selected-window)
-                                     (buffer-chars-modified-tick) (point)))))
+          (if company-candidates
+              (company-call-frontends 'post-command)
+            (and (numberp company-idle-delay)
+                 (or (eq t company-begin-commands)
+                     (memq this-command company-begin-commands))
+                 (setq company-timer
+                       (run-with-timer company-idle-delay nil
+                                       'company-idle-begin
+                                       (current-buffer) (selected-window)
+                                       (buffer-chars-modified-tick) (point))))))
       (error (message "Company: An error occurred in post-command")
              (message "%s" (error-message-string err))
              (company-cancel))))