Subject: Re: bug#59338: 29.0.50; Commit 1a2d603bb3 breaks Eglot on Windows

From: Augusto Stoffel <[email-masked]>
Date: Thu, 17 Nov 2022 18:12:05 -0500

On Thu, 17 Nov 2022 at 17:27, Danny Freeman wrote:

> ```
> (defun eglot--path-to-uri (path)
>   "URIfy PATH."
>   (let ((truepath (file-truename path)))
>     (if (and (url-type (url-generic-parse-url truepath))
>              (NOT_WINDOWS_PATH truepath) ;; what would this be?
>              )
>       ;; ... blah blah blah
> ```
>
> If there is no function available already, it may be enough to check if
> the return value of `url-type` is not 1 character. Looking at this list
> of what I believe are official URI schemes, all of them have at least
> two characters: 
> https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml 

I think that makes sense.  I find the above logic a bit funny, though.
What do you expect `truepath' to look like if `path' is actually an URI?
Shouldn't `path' be returned unchanged?

I also think that calling `url-generic-parse-url' might be overkill
here.  Based on
https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax I would
just test if `path' matches "\\`[A-Za-z][+.0-9A-Za-z-]+:".