emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 8e321eb 03/23: Auto-adjust company-idle-delay when it's ze


From: Dmitry Gutov
Subject: [elpa] master 8e321eb 03/23: Auto-adjust company-idle-delay when it's zero
Date: Fri, 11 Nov 2016 22:21:41 +0000 (UTC)

branch: master
commit 8e321ebb2ca5470b01990d6779cf42c3a07e4e9e
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Auto-adjust company-idle-delay when it's zero
    
    Closes #545.
---
 company.el |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/company.el b/company.el
index 9ce11a6..42d2486 100644
--- a/company.el
+++ b/company.el
@@ -735,9 +735,6 @@ keymap during active completions (`company-active-map'):
   nil company-lighter company-mode-map
   (if company-mode
       (progn
-        (when (eq company-idle-delay t)
-          (setq company-idle-delay 0)
-          (warn "Setting `company-idle-delay' to t is deprecated.  Set it to 0 
instead."))
         (add-hook 'pre-command-hook 'company-pre-command nil t)
         (add-hook 'post-command-hook 'company-post-command nil t)
         (mapc 'company-init-backend company-backends))
@@ -1638,11 +1635,13 @@ prefix match (same case) will be prioritized."
               (company--perform)))
           (if company-candidates
               (company-call-frontends 'post-command)
-            (and (numberp company-idle-delay)
+            (and (or (numberp company-idle-delay)
+                     ;; Deprecated.
+                     (eq company-idle-delay t))
                  (not defining-kbd-macro)
                  (company--should-begin)
                  (setq company-timer
-                       (run-with-timer company-idle-delay nil
+                       (run-with-timer (company--idle-delay) nil
                                        'company-idle-begin
                                        (current-buffer) (selected-window)
                                        (buffer-chars-modified-tick) 
(point))))))
@@ -1651,6 +1650,11 @@ prefix match (same case) will be prioritized."
              (company-cancel))))
   (company-install-map))
 
+(defun company--idle-delay ()
+  (if (memql company-idle-delay '(t 0 0.0))
+      0.01
+    company-idle-delay))
+
 (defvar company--begin-inhibit-commands '(company-abort
                                           company-complete-mouse
                                           company-complete



reply via email to

[Prev in Thread] Current Thread [Next in Thread]