Subject: bug#58790: Eglot URI parsing bug when using clojure-lsp server

From: Eli Zaretskii <[email-masked]>
Date: Thu, 10 Nov 2022 17:38:41 +0200

> From: João Távora <[email-masked]>
> Cc: Danny Freeman <[email-masked]>,  [email-masked],
>   [email-masked],  [email-masked],  [email-masked]
> Date: Thu, 10 Nov 2022 11:00:18 +0000
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Ping!  João, any comments on this patch?
> 
> Hi Eli, thanks for pinging.  Yes, had a look and _both_ patches look
> fine.

OK, then I have a few minor comments, before this can be installed:

> >From 936034d0e72621815584680a9e75f44a4448ba9d Mon Sep 17 00:00:00 2001
> From: dannyfreeman <[email-masked]>
> Date: Thu, 3 Nov 2022 09:39:16 -0400
> Subject: [PATCH 1/2] Only handle file:// type URIs in eglot explicitly
> 
> (Bug#58790)
> 
> This issue originated with clojure-lsp sending clients "jar": type URIs
> that emacs is unable to handle out of the box. Before this change, jar:
> URIs were parsed once, but since jar: URIs contain a nested URI,
> this resulted in a file being dispatched with a partially parsed path
> that looked like `file://path/to.jar!/path/in/jar`.
> 
> Now eglot will not attempt to parse URIs that are not file:// type at
> all, instead let file-name-handler-alist entries to deal with them.
> Not parsing them at all allows the file-name-handler-alist regexps to
> identify them more accurately.
> 
> By also checking if eglot received a URI in eglot--path-to-uri, the
> file-name-handler-alist can provide the non-file type URI back to the
> lsp server, which presumably will know how to handle them since it is
> also giving them out to clients.

This lacks ChangeLog-style parts which specify the file(s) and
function(s) which were changed.

Also, in the text above, please leave two spaces between sentences,
per our conventions, and refill the text to be at most 63 columns.

Finally, please consider moving some of the text above to comments
explaining why the code does what it does.

> >From 4c5dbc458ca1b13a897b6f01f69cacd9490c1ee1 Mon Sep 17 00:00:00 2001
> From: dannyfreeman <[email-masked]>
> Date: Thu, 3 Nov 2022 09:57:45 -0400
> Subject: [PATCH 2/2] Warn when eglot receives a non-file type URI that Emacs
>  can't handle
> 
> (bug#58790)
> 
> The file-name-operation being checked, any-handler, has no significant
> meaning, other than that it is not one that would be suppressed by
> inhibit-file-name-operation. We just want to check that a handler exists
> and has the potential to handle this URI, not actually dispatch a
> file-name-operation right now.

Same here.  And in this case, the text should definitely be in
comments.

Thanks.