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

From: João Távora <[email-masked]>
Date: Tue, 28 Feb 2023 14:51:17 +0000

On Tue, Feb 28, 2023 at 2:18 PM Michael Albinus <[email-masked]> wrote:

> The appended patch fixes the issue for me with Thomas' example. It binds
> tramp-use-ssh-controlmaster-options to nil before calling make-process,
> and that's sufficient for the majority of users.

Thanks.  Something like that patch is acceptable for now.

> Users, who have set ControlMaster in their ~/.ssh/config (like Thomas),
> are not satified. For them we need another setting of
> tramp-use-ssh-controlmaster-options. I'm working on this.

Looking at the Tramp code, I think Thomas's idea of using

  -o "ControlMaster=no" -o "ControlPath=none"

would probably be quite effective.  It would work with previous
Tramp versions that Eglot users might be using.  Thomas,
can you try this patch?

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index e20d209332d..83462633dd9 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -130,6 +130,8 @@
 (defvar markdown-fontify-code-blocks-natively)
 (defvar company-backends)
 (defvar company-tooltip-align-annotations)
+(defvar tramp-ssh-controlmaster-options)
+(defvar tramp-use-ssh-controlmaster-options)

@@ -1247,7 +1249,15 @@ eglot--connect
                         (contact (cl-subseq contact 0 probe)))
                    `(:process
                      ,(lambda ()
-                        (let ((default-directory default-directory))
+                        (let ((default-directory default-directory)
+                              ;; bug#61350: Tramp turns a feature on
+                              ;; by default that can't (yet) handle
+                              ;; very much data so we turn it off
+                              ;; unconditionally -- just for our
+                              ;; process.
+                              (tramp-use-ssh-controlmaster-options t)
+                              (tramp-ssh-controlmaster-options
+                               "-o ControlMaster=no -o ControlPath=none"))
                           (make-process
                            :name readable-name
                            :command (setq server-info (eglot--cmd contact))