]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow user to set idle time to wait before processing changes
authorambihelical <ambihelical@users.noreply.github.com>
Sat, 11 May 2019 18:41:52 +0000 (11:41 -0700)
committerJoão Távora <joaotavora@gmail.com>
Sat, 5 Oct 2019 11:56:38 +0000 (12:56 +0100)
* eglot.el (eglot-send-changes-idle-time): New defcustom.
(eglot--after-change): Use it.

Co-authored-by: João Távora <joaotavora@gmail.com>
Copyright-paperwork-exempt: yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/258

lisp/progmodes/eglot.el

index 0a9da05b1c6fc7285f68190a71fc51c1535590d9..1dc57113984d2d9cd51bad35a24bb5a433c72258 100644 (file)
@@ -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