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

From: Michael Albinus <[email-masked]>
Date: Tue, 28 Feb 2023 15:18:37 +0100

João Távora <[email-masked]> writes:

Hi Joao,

>> settings in ~/.ssh/config shall apply. And a new value, say `suppress',
>> shall suppress this feature even if enabled in ~/.ssh/config.
>>
>> I'll try to implement something along this line.
>
> Thanks.  I think that is a good start.  But can Eglot or the user
> somehow set 'suppress' for connections "motivated" by Eglot, i.e. M-x
> eglot in some remote file?  How?

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.

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.

> João

Best regards, Michael.

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index ffc9511469f..71271ca0b0a 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1214,6 +1214,8 @@ eglot--cmd
 (defvar-local eglot--cached-server nil
   "A cached reference to the current Eglot server.")

+(defvar tramp-use-ssh-controlmaster-options)
+
 (defun eglot--connect (managed-modes project class contact language-id)
   "Connect to MANAGED-MODES, LANGUAGE-ID, PROJECT, CLASS and CONTACT.
 This docstring appeases checkdoc, that's all."
@@ -1249,7 +1251,9 @@ eglot--connect
                         (contact (cl-subseq contact 0 probe)))
                    `(:process
                      ,(lambda ()
-                        (let ((default-directory default-directory))
+                        (let ((default-directory default-directory)
+                              ;; See bug#61350.
+                              tramp-use-ssh-controlmaster-options)
                           (make-process
                            :name readable-name
                            :command (setq server-info (eglot--cmd contact))