From: Danny Freeman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: arash@gnu.org, arstoffel@gmail.com, 59338@debbugs.gnu.org
Subject: bug#59338: 29.0.50; Commit 1a2d603bb3 breaks Eglot on Windows
Date: Fri, 18 Nov 2022 09:55:47 -0500 [thread overview]
Message-ID: <87bkp4wazv.fsf@dfreeman.email> (raw)
In-Reply-To: <83zgco9vqe.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> If it is a full windows path, we DO want to turn that into a file url.
>>
>> So how do we detect that is is a windows path, and not a URL already?
>
> You test that system-type is windows-nt AND that the
> file-name-absolute-p returns non-nil for the argument.
That is incredible simple. Maybe something like this patch will work:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Eglot-don-t-confuse-URLs-and-windows-file-paths.patch --]
[-- Type: text/x-patch, Size: 1419 bytes --]
From 85821844094e5d00ceb01902c55d9aa0fef73d17 Mon Sep 17 00:00:00 2001
From: dannyfreeman <danny@dfreeman.email>
Date: Fri, 18 Nov 2022 10:09:17 -0500
Subject: [PATCH] Eglot: don't confuse URLs and windows file paths
* lisp/progmodes/eglot.el (eglot--path-to-uri): check for windows path
---
lisp/progmodes/eglot.el | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index c2d7fc309d..4661cf0e1a 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1502,11 +1502,15 @@ eglot--uri-path-allowed-chars
(defun eglot--path-to-uri (path)
"URIfy PATH."
(let ((truepath (file-truename path)))
- (if (url-type (url-generic-parse-url truepath))
+ (if (and (url-type (url-generic-parse-url path))
+ ;; It might be a windows path which includes a drive
+ ;; letter that looks like a URL scheme
+ (not (and (eq system-type 'windows-nt)
+ (file-name-absolute-p 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
+ path
(concat "file://"
;; Add a leading "/" for local MS Windows-style paths.
(if (and (eq system-type 'windows-nt)
--
2.38.1
[-- Attachment #3: Type: text/plain, Size: 133 bytes --]
I can confirm it works on linux, but I don't have a windows machine.
Someone else would need to verify it there.
--
Danny Freeman
next prev parent reply other threads:[~2022-11-18 14:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 16:51 bug#59338: 29.0.50; Commit 1a2d603bb3 breaks Eglot on Windows Arash Esbati
2022-11-17 17:06 ` Eli Zaretskii
2022-11-17 17:18 ` Augusto Stoffel
2022-11-17 22:27 ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-17 23:12 ` Augusto Stoffel
2022-11-18 7:14 ` Eli Zaretskii
2022-11-18 13:39 ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-18 14:35 ` Eli Zaretskii
2022-11-18 14:55 ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-11-18 20:01 ` Arash Esbati
2022-11-18 7:12 ` Eli Zaretskii
2022-11-23 12:51 ` João Távora
2022-11-24 13:42 ` Danny Freeman via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-24 15:27 ` João Távora
2022-11-17 22:33 ` Arash Esbati
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bkp4wazv.fsf@dfreeman.email \
--to=bug-gnu-emacs@gnu.org \
--cc=59338@debbugs.gnu.org \
--cc=arash@gnu.org \
--cc=arstoffel@gmail.com \
--cc=danny@dfreeman.email \
--cc=eliz@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.