emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 08c80c45dde: Don't use file-truepath in Eglot (bug#70036)


From: João Távora
Subject: Re: master 08c80c45dde: Don't use file-truepath in Eglot (bug#70036)
Date: Thu, 18 Apr 2024 16:00:53 +0100

On Thu, Apr 18, 2024 at 10:57 AM Theodor Thornhill <theo@thornhill.no> wrote:

> >> If we need to support symlinks in Emacs instead of leaving this to the
> >> LSP servers, we could perhaps do that once in some strategic place,
> >> instead of using file-truename everywhere where normally
> >> expand-file-name would do.  Or maybe explicitly test with
> >> file-symlink-p before using file-truename, which is (and has to be)
> >> pretty expensive.  IOW, "punishing" everyone for the benefit of
> >> relatively rare use cases is not the best optimization.
> >
> > As far as I can tell, file-truename is (was) only used "naked"
> > once or twice,  I think it's the use inside "find-buffer-visiting" which is 
> > the
> > most crucial for the scenarios at hand.  I'll try to see if I can separate
> > them.
> >
> > João
>
> This is correct. The find-buffer-visiting is the most crucial one.

And that one is a longstanding Emacs util function that is already
a good "strategic place" IMO.

So there is only one naked call to file-truename, in eglot--path-to-uri.
"URI" is what the server understands so it's essential that we tell
it the real name of the file visited in the Emacs buffer so as not
to trick it.  It's fairly easy to cache eglot--path-to-uri results
on a case by case basis though.

So to summarize:

* we don't use it "everywhere".  We use it once where it matters.
* the "punishment" isn't really severe and the little there was
  of it has been completely  avoided with my changes.

João



reply via email to

[Prev in Thread] Current Thread [Next in Thread]