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#58790: Eglot URI parsing bug when using clojure-lsp server Date: Sun, 13 Nov 2022 16:04:02 -0500 Message-ID: <87mt8uwo2q.fsf@dfreeman.email> References: <8cf8ba5d-c604-b2dc-274a-7597b19fb73f@dfreeman.email> <87ilk5xq01.fsf@gmail.com> <87r0yrwfn3.fsf@gmail.com> <37716e41-5955-99f6-5204-e760a716fbf6@yandex.ru> <9bb290c8-f000-31d8-265d-b5441c33eb38@dfreeman.email> <4d50b820-7053-75eb-5b11-d3d36a02b013@dfreeman.email> <87v8nxsrq6.fsf@gmail.com> <87cza40xgs.fsf@dfreeman.email> <83edubrvf0.fsf@gnu.org> <87cz9v9irh.fsf@gmail.com> <83o7terf9a.fsf@gnu.org> <87k042tqze.fsf@dfreeman.email> <87fseqtpiu.fsf@dfreeman.email> <875yfm8lzf.fsf@gmail.com> <83wn82osoo.fsf@gnu.org> <871qq8xfzr.fsf@gmx.de> 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="6182"; mail-complaints-to="usenet@ciao.gmane.io" Cc: felician.nemeth@gmail.com, danny@dfreeman.email, 58790@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , dgutov@yandex.ru, Eli Zaretskii , stefankangas@gmail.com To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 13 22:19:24 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 1ouKNw-0001Ss-CY for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Nov 2022 22:19:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ouKNb-0002vd-LM; Sun, 13 Nov 2022 16:19:03 -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 1ouKNa-0002vT-ER for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2022 16:19: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 1ouKNa-0007N6-6b for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2022 16:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ouKNa-0002UG-2R for bug-gnu-emacs@gnu.org; Sun, 13 Nov 2022 16:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Danny Freeman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Nov 2022 21:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58790 X-GNU-PR-Package: emacs Original-Received: via spool by 58790-submit@debbugs.gnu.org id=B58790.16683743119522 (code B ref 58790); Sun, 13 Nov 2022 21:19:02 +0000 Original-Received: (at 58790) by debbugs.gnu.org; 13 Nov 2022 21:18:31 +0000 Original-Received: from localhost ([127.0.0.1]:48488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ouKN4-0002TW-Op for submit@debbugs.gnu.org; Sun, 13 Nov 2022 16:18:31 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]:41749) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ouKN3-0002TN-0u for 58790@debbugs.gnu.org; Sun, 13 Nov 2022 16:18:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dfreeman.email; s=key1; t=1668374307; 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=GhZ2EH8HsU+S4h64RJKYOGPuwKC98vqsd38IT8tv+jM=; b=tV5G5WoI6Ndcd1/vUQF6Jhur3eaROs14daEbPHeui6QMz71CguXEGiKZZP1VJYLs1LPt4K 16Z1oF4kZ5mZWP1Gw4TrzyZnBvS0kyJIIU0ti+wDRWWTEDzBJTivyMWgYQxm+KuvUbAAke 1pq6+jRBtxFQ91ZRZbUtPoTjww60tCQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-reply-to: <871qq8xfzr.fsf@gmx.de> X-Migadu-Flow: FLOW_OUT 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:247818 Archived-At: --=-=-= Content-Type: text/plain Michael Albinus writes: > Well, using nil as operation might work in this special case, but it > disables an important feature of file name handlers: use of > inhibit-file-name-operation. That's why it shouldn't be documented as > such. > > Using just an arbitrary symbol as operation looks better to me. If you > use an existing operation name, like access-file, it could conflict later > with the inhibit-file-name-operation/inhibit-file-name-handlers machinery. > > This said, I don't understand why you need this check at all. But I > haven't followed the eglot discussion closely. > > Best regards, Michael. Thanks for your insights Michael! If you are curious, this code in eglot is about to round-aboutly call `find-file-noselect' on a URI, which Emacs will probably fail to open if there is no registered file name handler. So before doing that we write a message warning the user if no file name handler is registered. That's the idea. With this info I've written up another patch that checks find-file-name-handler with an arbitrary symbol (with a better name than my first attempt, IMO). I've tried to strike a balance between inline comments and the commit message. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Eglot-Warn-when-receiving-a-non-file-type-URI-bug-58.patch Content-Description: eglot file name handler warning patch >From 86a444be767a3e160f60e46086e38ef154134683 Mon Sep 17 00:00:00 2001 From: dannyfreeman Date: Thu, 10 Nov 2022 19:07:46 -0500 Subject: [PATCH] Eglot: Warn when receiving a non-file type URI (bug#58790) When this occurs, Emacs will probably not know how to open up the URI. The warning may help users when investigating a potential solution. * lisp/progmodes/eglot.el (eglot--uri-to-path): warn on unhandled URI --- lisp/progmodes/eglot.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 97c674f7aa..97febdacc2 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1534,7 +1534,11 @@ If optional MARKER, return a marker instead" (substring retval 1) retval))) (concat remote-prefix normalized)) - + ;; Use a fake operation, eglot--fake-file-name-op because we + ;; don't want this check to be suppressed by `inhibit-file-name-operation'. + ;; We just want to see if a handler exists. + (unless (find-file-name-handler uri 'eglot--fake-file-name-op) + (eglot--message "Received URI with unexpected scheme: %s" uri)) uri))) (defun eglot--snippet-expansion-fn () -- 2.38.1 --=-=-= Content-Type: text/plain -- Danny Freeman --=-=-=--