Hi Eli: Thanks for responding. Confirmed that applying the patch locally solves the issue. Appreciate the help here! ________________________________ From: Eli Zaretskii Sent: Monday, May 12, 2025 8:16 AM To: admin@sonictk.com ; Joćo Tįvora Cc: 78392@debbugs.gnu.org <78392@debbugs.gnu.org> Subject: Re: bug#78392: 31.0.50; eglot breaks on xref-find-definitions > From: "admin@sonictk.com" > Date: Mon, 12 May 2025 06:29:15 +0000 > > Currently, when building from latest Emacs ToT, activating `eglot-mode` > in any C++ file using `clangd` and attempting to call > `xref-find-definitions` on any definition results in the following error > being triggered: > > ``` > Opening input file: Is a directory, c:/Users/sonictk/tmp > ``` > > Where the `.cpp` file is in the given directory. Tried building Emacs > using a build from a month-ish ago to find where the regression first > occurred and it still had the issue present, even when doing `make > distclean` and then `make bootstrap` after re-running `./configure`. > > `toggle-debug-on-error` gives me: > > ``` > Debugger entered--Lisp error: (file-error "Opening input file" "Is a directory" "c:/Users/sonictk/tmp") > eglot--xref-make-match(#("Baz" 0 3 (face font-lock-function-name-face fontified t)) > "file:///c:/Users/sonictk/tmp/test2.cpp" (:end (:character 11 :line 23) :start (:character 8 :line 23))) > #f(compiled-function (loc-or-loc-link) #)((:range (:end (:character 11 :line > 23) :start (:character 8 :line 23)) :uri "file:///c:/Users/sonictk/tmp/test2.cpp")) > eglot--lsp-xrefs-for-method(:textDocument/definition) > #f(compiled-function (backend id) #)(eglot "LSP identifier at point") > apply(#f(compiled-function (backend id) #) eglot "LSP identifier at > point") > xref-backend-definitions(eglot "LSP identifier at point") > #f(compiled-function () #)() > xref-show-definitions-buffer(#f(compiled-function () #) ((window . > #) (display-action) (auto-jump))) > xref--show-defs(#f(compiled-function () #) nil) > xref--find-definitions("LSP identifier at point" nil) > xref-find-definitions("LSP identifier at point") > funcall-interactively(xref-find-definitions "LSP identifier at point") > command-execute(xref-find-definitions) > ``` Thanks. Does the patch below give good results? Joćo, I think the assumption that 'retval' there necessarily starts with a slash is because url-generic-parse-url would not necessarily DTRT with Windows file:// URIs; it was fixed lately. So now we need to test for that before applying the fixup. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index eae8e1b..6f6b05a 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1165,7 +1165,8 @@ eglot-uri-to-path ;; Remove the leading "/" for local MS Windows-style paths. (normalized (if (and (not remote-prefix) (eq system-type 'windows-nt) - (cl-plusp (length retval))) + (cl-plusp (length retval)) + (eq (aref retval 0) ?/)) (w32-long-file-name (substring retval 1)) retval))) (concat remote-prefix normalized))