From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Danny Freeman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#59338: 29.0.50; Commit 1a2d603bb3 breaks Eglot on Windows Date: Fri, 18 Nov 2022 09:55:47 -0500 Message-ID: <87bkp4wazv.fsf@dfreeman.email> References: <86bkp5y16y.fsf@gnu.org> <83r0y1cxyb.fsf@gnu.org> <87o7t5wlby.fsf@gmail.com> <87bkp5xl6f.fsf@dfreeman.email> <87fsehw4ze.fsf@gmail.com> <83cz9kd99x.fsf@gnu.org> <87wn7swf4e.fsf@dfreeman.email> <83zgco9vqe.fsf@gnu.org> Reply-To: Danny Freeman Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8736"; mail-complaints-to="usenet@ciao.gmane.io" Cc: arash@gnu.org, arstoffel@gmail.com, 59338@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 18 16:15:18 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ow35J-00024A-1t for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Nov 2022 16:15:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ow356-0001ko-05; Fri, 18 Nov 2022 10:15:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ow354-0001hw-4D for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 10:15:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ow353-00025R-RB for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 10:15:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ow353-0002jb-N4 for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 10:15:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Danny Freeman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Nov 2022 15:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59338 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: arash@gnu.org, arstoffel@gmail.com, bug-gnu-emacs@gnu.org, 59338@debbugs.gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166878448810476 (code B ref -1); Fri, 18 Nov 2022 15:15:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Nov 2022 15:14:48 +0000 Original-Received: from localhost ([127.0.0.1]:37907 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ow34p-0002iu-PR for submit@debbugs.gnu.org; Fri, 18 Nov 2022 10:14:48 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:45460) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ow34o-0002in-UO for submit@debbugs.gnu.org; Fri, 18 Nov 2022 10:14:47 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ow34j-0001Wk-DY for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 10:14:44 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ow34e-00022T-L7; Fri, 18 Nov 2022 10:14:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dfreeman.email; s=key1; t=1668784472; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=t4v3uME8TjJiiZzplBn2ad1jXqBMdWHLHWaEvOVW2Eg=; b=OFjmJDCRtrzSHVYWAh1eygtN9vQYtsUJxx8mObHQEWxNacPIfPquzy02igRSA5eDl7+7St sHso1kx09SjhOepsUIMvGPLG+IjXxCCpeJsxhCiXPtwce4gOpfiUmN5HqUg/WL/vftW+vB MF+/0SBL35WPc+nfZmChImV1bGh8TGU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: <83zgco9vqe.fsf@gnu.org> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=188.165.223.204; envelope-from=danny@dfreeman.email; helo=out2.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:248250 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii 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: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Eglot-don-t-confuse-URLs-and-windows-file-paths.patch >From 85821844094e5d00ceb01902c55d9aa0fef73d17 Mon Sep 17 00:00:00 2001 From: dannyfreeman 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 --=-=-= Content-Type: text/plain 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 --=-=-=--