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

From: Michael Albinus <[email-masked]>
Date: Tue, 28 Feb 2023 16:01:43 +0100

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

Hi João,

> 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.

Yes, that I have also in mind.

> 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))

Even better than my proposal :-)

There is the small risk that a user runs a local ssh client which is
not aware of the ControlMaster option. For such a user, Eglot on a
remote host might fail.

Tramp is busy to check, whether ControlMaster could be applied.

OTOH, I don't know if such ssh clients are still used in the wild, at
least by Eglot users.

Best regards, Michael.