diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 8d3977091d..b240e0e860 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1345,7 +1345,10 @@ THINGS are either registrations or unregisterations." (defun eglot--TextDocumentIdentifier () "Compute TextDocumentIdentifier object for current buffer." - `(:uri ,(eglot--path-to-uri buffer-file-name))) + `(:uri ,(eglot--path-to-uri (or buffer-file-name + (ignore-errors + (buffer-file-name + (buffer-base-buffer))))))) (defvar-local eglot--versioned-identifier 0)