unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: jeberger@free.fr, 61748@debbugs.gnu.org
Subject: bug#61748: 27.2; Eglot should use shell-file-name when launching the language server for a remote file
Date: Thu, 02 Mar 2023 10:56:22 +0000	[thread overview]
Message-ID: <877cvz8lrd.fsf@gmail.com> (raw)
In-Reply-To: <878rgfecra.fsf@gmx.de> (Michael Albinus's message of "Thu, 02 Mar 2023 10:14:17 +0100")

Michael Albinus <michael.albinus@gmx.de> writes:

>>> I'll play with it. Perhaps there is a smarter version of it, as you say.
>>
>> Here's another still untested but smarter patch.  Caches fully
>> on until user messes with tramp-remote-path, else immediately
>> flushed.
>
> Just flushing the connection property "remote-path" is not sufficient I
> believe.

I've tested it and it works just fine on my end.  What problems did you
see.

Let me be clear about what i'm attempting to fix, using condensed Emacs
-Q recipes that illustrate what I do during actual sessions.

Before applying my patch, this prints "jdtls", correctly

    ~/Source/Emacs/emacs/src/emacs -Q --batch                \
    -l tramp                                                 \
    --eval '(add-to-list (quote tramp-remote-path) "~/bin")' \
    $REMOTE_FILE                                             \
    --eval '(message "%s" (executable-find "jdtls" t))'

which is fine, of course.  You happened to remember early enough that
the remote host you're going to connect to needs a ~/bin in
tramp-remote-path, so you set that early.

But if you don't remember at the right time, like here:

    ~/Source/Emacs/emacs/src/emacs -Q --batch $REMOTE_FILE   \
    -l tramp                                                 \
    --eval '(add-to-list (quote tramp-remote-path) "~/bin")' \
    --eval '(message "%s" (executable-find "jdtls" t))'

It prints nil.

I find this very confusing, and lost many hours to it.  I expect
'tramp-remote-path' to work like most other variables: set values with
M-:, custom-set-variable, etc.  Then verify the settings work, then
maybe put that in my init file.

After my patch, both invocations print "jdtls".  Can't see how it
doesn't improve things.  Is trivial to understand and has no performance
drawbacks.  It relieves users from keeping a mental model of Tramp's
caches.

> You still must cleanup the process. This is because the remote
> PATH environment is set when starting the process.

This is doesn't differ from local PATH vs local exec-path.  You add
things to exec-path that affect `executable-find`, but don't affect
PATH.

> And I fail to understand, why connection-local variables don't serve the
> purpose. They are described wrt to the remote path in
>
> (info "(tramp) Remote programs")

How am I to use "connection-local variables" here?  Reading the manual
it seems I add multiple setting to my configuration for every host I
connect to.  Like dir-local variables.  That's fine, but I don't know
those hosts and settings in advance.  And if I wanted to change my
configuration, setting tramp-remote-path early on in my .emacs _already_
works.  Which is exactly the confusing part.

> If this isn't sufficient, we must improve this, instead of introducing
> another mechanism.

I'm not proposing new mechanisms or changes to existing ones.  Simply to
invalidate a cache value when there are changes to the source of truth
whence said cached value came.  IME, this is pretty standard thing to
do.

> And remember, remote processes are not designed to be
> as flexible as local processes, where you could simply call
> (setenv "PATH" ...)

I never do that, and I don't want to do that anyway.  I just want
executable-find to not be tricked by some misinvalidated cache.

João





  reply	other threads:[~2023-03-02 10:56 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1909672588.15608265.1677223717877.JavaMail.root@zimbra60-e10.priv.proxad.net>
2023-02-24  7:39 ` bug#61748: 27.2; Eglot should use shell-file-name when launching the language server for a remote file jeberger
2023-02-24  8:15   ` Eli Zaretskii
2023-02-24 11:11     ` jeberger
2023-02-24 16:44       ` Michael Albinus
2023-02-27 11:07   ` João Távora
2023-02-27 12:05     ` João Távora
2023-02-27 17:59       ` bug#61748: [informatique] " Jérôme M. Berger
2023-02-27 23:41         ` João Távora
2023-02-28  9:50           ` jeberger
2023-02-28 10:14             ` Michael Albinus
2023-02-28 10:28               ` João Távora
2023-02-27 19:57       ` Michael Albinus
2023-02-27 20:07         ` João Távora
2023-02-27 20:13           ` Michael Albinus
2023-02-28  0:00             ` João Távora
2023-02-28  8:41               ` Michael Albinus
2023-02-28 12:18                 ` João Távora
2023-02-28 12:34                   ` Michael Albinus
2023-02-28 12:46                     ` João Távora
2023-02-28 13:05                       ` Michael Albinus
2023-02-28 13:47                         ` João Távora
2023-02-28 14:10                           ` Michael Albinus
2023-02-28 14:24                             ` João Távora
2023-02-28 14:45                               ` Michael Albinus
2023-02-28 15:13                                 ` João Távora
2023-02-28 15:44                                   ` Michael Albinus
2023-02-28 16:43                               ` Eli Zaretskii
2023-02-28 16:49                                 ` João Távora
2023-02-28 17:56                                   ` Eli Zaretskii
2023-03-01  4:34                                     ` Richard Stallman
2023-03-01  9:31                                       ` João Távora
2023-03-01 13:04                                         ` Eli Zaretskii
2023-03-01 13:05                                           ` João Távora
2023-02-28 13:59                   ` jeberger
2023-02-28 14:25                     ` João Távora
2023-02-28 14:49                       ` Michael Albinus
2023-02-28 14:53                         ` João Távora
2023-02-28 15:15                           ` Michael Albinus
2023-02-28 15:23                             ` João Távora
2023-02-28 15:50                               ` Michael Albinus
2023-02-28 16:28                                 ` João Távora
2023-03-02  9:14                                   ` Michael Albinus
2023-03-02 10:56                                     ` João Távora [this message]
2023-03-02 11:40                                       ` Michael Albinus
2023-03-03  0:24                                         ` João Távora
2023-02-28 14:49                       ` jeberger
2023-02-28 15:07                         ` João Távora
2023-02-28 15:12                         ` Michael Albinus
2023-02-28 16:16                           ` jeberger
2023-02-28 16:41                             ` jeberger
2023-02-28 17:09                               ` João Távora
2023-03-01  8:09                                 ` jeberger
2023-03-02 13:28                                   ` João Távora
2023-03-07 10:15                                     ` João Távora
2023-03-01  8:39                               ` Michael Albinus
2023-03-01  8:51                                 ` jeberger
2023-03-01  9:07                                   ` Michael Albinus
2023-03-01 10:01                                     ` jeberger
2023-03-01 10:11                                       ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877cvz8lrd.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=61748@debbugs.gnu.org \
    --cc=jeberger@free.fr \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).