From: ambihelical Date: Sat, 11 May 2019 18:41:52 +0000 (-0700) Subject: Allow user to set idle time to wait before processing changes X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~309 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=374ce4e29f1b025feed77aa2cb7e90a67864760e;p=emacs.git Allow user to set idle time to wait before processing changes * eglot.el (eglot-send-changes-idle-time): New defcustom. (eglot--after-change): Use it. Co-authored-by: João Távora Copyright-paperwork-exempt: yes GitHub-reference: fix https://github.com/joaotavora/eglot/issues/258 --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 0a9da05b1c6..1dc57113984 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -174,6 +174,10 @@ as 0, i.e. don't block at all." "If non-nil, shut down server after killing last managed buffer." :type 'boolean) +(defcustom eglot-send-changes-idle-time 0.5 + "Don't tell server of changes before Emacs's been idle for this many seconds." + :type 'number) + (defcustom eglot-events-buffer-size 2000000 "Control the size of the Eglot events buffer. If a number, don't let the buffer grow larger than that many @@ -1591,10 +1595,11 @@ Records BEG, END and PRE-CHANGE-LENGTH locally." (let ((buf (current-buffer))) (setq eglot--change-idle-timer (run-with-idle-timer - 0.5 nil (lambda () (eglot--with-live-buffer buf - (when eglot--managed-mode - (eglot--signal-textDocument/didChange) - (setq eglot--change-idle-timer nil)))))))) + eglot-send-changes-idle-time + nil (lambda () (eglot--with-live-buffer buf + (when eglot--managed-mode + (eglot--signal-textDocument/didChange) + (setq eglot--change-idle-timer nil)))))))) ;; HACK! Launching a deferred sync request with outstanding changes is a ;; bad idea, since that might lead to the request never having a