On Wed, Nov 23, 2022 at 1:34 PM Eli Zaretskii <eliz@gnu.org> wrote:
> From: João Távora <joaotavora@gmail.com>
> Date: Wed, 23 Nov 2022 12:36:37 +0000
> Cc: Danny Freeman <danny@dfreeman.email>, Felician Nemeth <felician.nemeth@gmail.com>,
>       58790@debbugs.gnu.org, Stefan Kangas <stefankangas@gmail.com>,
>       Dmitry Gutov <dgutov@yandex.ru>, Eli Zaretskii <eliz@gnu.org>,
>       Michael Albinus <michael.albinus@gmx.de>
>
> Yes,I think I follow.  To be clear I think the problem is somewhere in
>
> (defun eglot--path-to-uri (path)
>   "URIfy PATH."
>   (let ((truepath (file-truename path)))
>     (if (url-type (url-generic-parse-url truepath))
>         ;; Path is already a URI, so forward it to the LSP server
>         ;; untouched.  The server should be able to handle it, since
>         ;; it provided this URI to clients in the first place.
>         truepath
>       ...)
>
> So either url-generic-parse-url and url-type is fixed in url-parse.el, or
> we must add some Windows-specific guards in eglot.el.  Or likely
> both, since url-parse.el is not a :core ELPA package.
>
> Richard/Danny, can you perhaps come up with some patch?

From where I stand, the solution was already proposed here:

  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59338#53

Right. When I wrote that, I was unaware of this second bug report.
 
You said you wanted to augment it with something that didn't depend on
url-parse.el, because it wasn't in Emacs < 29, but I don't think I
understand the concern, since AFAICT url-parse.el is in all versions of
Emacs since at least Emacs 23.  So what am I missing?

Maybe I misunderstood, but it seemed like you were proposing that
we change url-parse.el so that  it isn't fooled into thinking windows path
names are URLs with the drive letter as the 'url-type'.

If that were the correct solution (I tend to think it is), then it would
_not_ suffice to fix Eglot on Emacsen older than 29, because url-parse.el
is not distributed separately as a :core ELPA package.

So unless we made url-parse.el such a package, we would need a Danny's
"kludgy" patch to eglot.el anyway.

In any case, I suggest that a solution be based on the patch shown in that
bug#59338 discussion.

Having now read Danny's patch, I think it's good to commit.

João