Subject: Re: bug#61350: Eglot over Tramp freezes with large project

From: João Távora <[email-masked]>
Date: Thu, 23 Feb 2023 14:18:31 +0000

> Can you try your experiment again after evaluating these two lines?

>   (cl-defmethod eglot-handle-notification :around (_ _ &key &allow-other-keys)
>     (run-at-time 0 nil (lambda () (cl-call-next-method))))

I forgot to mention that one should evaluate that in a
buffer were lexical-binding is t.

Better try this jsonrpc.el patch instead which does basically
the same, but won't have this pitfall.

diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index f583d116d20..45e3d97ca41 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -184,8 +184,8 @@ jsonrpc-connection-receive
           (apply #'jsonrpc--reply connection id reply)))
        (;; A remote notification
         method
-        (funcall (jsonrpc--notification-dispatcher connection)
-                 connection (intern method) params))
+        (run-at-time 0 nil (jsonrpc--notification-dispatcher connection)
+                     connection (intern method) params))
        (;; A remote response
         (setq continuations
               (and id (gethash id (jsonrpc--request-continuations
connection))))

João