From: Dmitry Gutov Date: Sat, 16 May 2015 20:48:46 +0000 (+0300) Subject: Don't use `sit-for' X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/c08dbc18f76de7275368780e564947453cb7bce6 Don't use `sit-for' Fixes #353 (global-hl-line-mode flickering). --- diff --git a/company.el b/company.el index 916374990..ec4210340 100644 --- a/company.el +++ b/company.el @@ -1508,6 +1508,7 @@ from the rest of the back-ends in the group, if any, will be left at the end." company-point nil) (when company-timer (cancel-timer company-timer)) + (company-echo-cancel t) (company-search-mode 0) (company-call-frontends 'hide) (company-enable-overriding-keymap nil)) @@ -1538,6 +1539,7 @@ from the rest of the back-ends in the group, if any, will be left at the end." (when company-timer (cancel-timer company-timer) (setq company-timer nil)) + (company-echo-cancel t) (company-uninstall-map)) (defun company-post-command () @@ -2751,13 +2753,19 @@ Returns a negative number if the tooltip should be displayed above point." (message "")))) (defun company-echo-show-soon (&optional getter) + (company-echo-cancel) + (setq company-echo-timer (run-with-timer 0 nil 'company-echo-show getter))) + +(defun company-echo-cancel (&optional unset) (when company-echo-timer (cancel-timer company-echo-timer)) - (setq company-echo-timer (run-with-timer 0 nil 'company-echo-show getter))) + (when unset + (setq company-echo-timer nil))) -(defsubst company-echo-show-when-idle (&optional getter) - (when (sit-for company-echo-delay) - (company-echo-show getter))) +(defun company-echo-show-when-idle (&optional getter) + (company-echo-cancel) + (setq company-echo-timer + (run-with-idle-timer company-echo-delay nil 'company-echo-show getter))) (defun company-echo-format ()