]> git.eshelyaron.com Git - emacs.git/commitdiff
Only call deferred actions after a full message has been received
authorJoão Távora <joaotavora@gmail.com>
Thu, 10 May 2018 12:52:21 +0000 (13:52 +0100)
committerJoão Távora <joaotavora@gmail.com>
Thu, 10 May 2018 12:52:37 +0000 (13:52 +0100)
Otherwise it can be quite wasteful.

* eglot.el (eglot--process-filter): Don't eglot--call-deferred here.
(eglot--process-receive): Do it here.

lisp/progmodes/eglot.el

index d49367b5fefcea81d8bb81e5f1169a6bb437999b..8b8d7122444d27948f8ebe861d9b5f7a4a59bb9b 100644 (file)
@@ -380,6 +380,7 @@ INTERACTIVE is t if called interactively."
               "(sentinel) Not auto-reconnecting, last one didn't last long."
               change)))
       (delete-process proc))))
+
 (defun eglot--process-filter (proc string)
   "Called when new data STRING has arrived for PROC."
   (when (buffer-live-p (process-buffer proc))
@@ -441,8 +442,7 @@ INTERACTIVE is t if called interactively."
                       (throw done :waiting-for-more-bytes-in-this-message))))))))
           ;; Saved parsing state for next visit to this filter
           ;;
-          (setf (eglot--expected-bytes proc) expected-bytes))))
-    (eglot--call-deferred proc)))
+          (setf (eglot--expected-bytes proc) expected-bytes))))))
 
 (defun eglot-events-buffer (process &optional interactive)
   "Display events buffer for current LSP connection PROCESS.
@@ -522,6 +522,7 @@ is a symbol saying if this is a client or server originated."
                  (funcall (cl-first continuations) res)))))
           (id
            (eglot--warn "Ooops no continuation for id %s" id)))
+    (eglot--call-deferred proc)
     (force-mode-line-update t)))
 
 (defvar eglot--expect-carriage-return nil)