branch: externals/company commit f12295966e552a397349126a75dbc93e4fedc7ec Author: Dmitry Gutov <dgu...@yandex.ru> Commit: Dmitry Gutov <dgu...@yandex.ru>
Use non-idle timer for company-echo-metadata-frontend Fixes #548. --- company.el | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/company.el b/company.el index 89b9165..cdd9320 100644 --- a/company.el +++ b/company.el @@ -3538,9 +3538,11 @@ Delay is determined by `company-tooltip-idle-delay'." (message "%s" company-echo-last-msg) (message "")))) -(defun company-echo-show-soon (&optional getter) +(defun company-echo-show-soon (&optional getter delay) (company-echo-cancel) - (setq company-echo-timer (run-with-timer 0 nil 'company-echo-show getter))) + (setq company-echo-timer (run-with-timer (or delay company-echo-delay) + nil + 'company-echo-show getter))) (defun company-echo-cancel (&optional unset) (when company-echo-timer @@ -3548,11 +3550,6 @@ Delay is determined by `company-tooltip-idle-delay'." (when unset (setq company-echo-timer nil))) -(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 () (let ((selection (or company-selection 0))) (let ((limit (window-body-width (minibuffer-window))) @@ -3618,19 +3615,19 @@ Delay is determined by `company-tooltip-idle-delay'." (defun company-echo-frontend (command) "`company-mode' frontend showing the candidates in the echo area." (pcase command - (`post-command (company-echo-show-soon 'company-echo-format)) + (`post-command (company-echo-show-soon 'company-echo-format 0)) (`hide (company-echo-hide)))) (defun company-echo-strip-common-frontend (command) "`company-mode' frontend showing the candidates in the echo area." (pcase command - (`post-command (company-echo-show-soon 'company-echo-strip-common-format)) + (`post-command (company-echo-show-soon 'company-echo-strip-common-format 0)) (`hide (company-echo-hide)))) (defun company-echo-metadata-frontend (command) "`company-mode' frontend showing the documentation in the echo area." (pcase command - (`post-command (company-echo-show-when-idle 'company-fetch-metadata)) + (`post-command (company-echo-show-soon 'company-fetch-metadata)) (`hide (company-echo-hide)))) (provide 'company)