Subject: bug#61748: 27.2; Eglot should use shell-file-name when launching the language server for a remote file

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

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

Hi João,

>> I don't expect a user to solve it. And a user shouldn't expect that
>> changing a variable is sufficient.
>
> I respectfully but diametrically disagree here.
>
> Here's an untested patch that could solve this.  It can probably
> be made smarter by only invalidating the cache when a change
> to the variable is detected.

Hmm. It will delay startup of remote processes, if tramp-remote-path
doesn't change for different processes. Perhaps it is negligable, but at
least for slow connections people will be hit by this.

I'll play with it. Perhaps there is a smarter version of it, as you say.

> João
>
> diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
> index ec8437176db..eae00923395 100644
> --- a/lisp/net/tramp-sh.el
> +++ b/lisp/net/tramp-sh.el
> @@ -5578,11 +5578,7 @@ tramp-get-remote-path
>      ;; Expand connection-local variables.
>      (tramp-set-connection-local-variables vec)
>      (with-tramp-connection-property
> - ;; When `tramp-own-remote-path' is in `tramp-remote-path', we
> - ;; cache the result for the session only.  Otherwise, the
> - ;; result is cached persistently.
> - (if (memq 'tramp-own-remote-path tramp-remote-path)
> -     (tramp-get-process vec) vec)
> + (tramp-get-process vec)
>   "remote-path"
>        (let* ((remote-path (copy-tree tramp-remote-path))
>        (elt1 (memq 'tramp-default-remote-path remote-path))

Best regards, Michael.