]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't break in indirect buffers
authorJoão Távora <joaotavora@gmail.com>
Sat, 1 Dec 2018 22:47:56 +0000 (22:47 +0000)
committerJoão Távora <joaotavora@gmail.com>
Sat, 1 Dec 2018 22:47:56 +0000 (22:47 +0000)
Indirect buffers, such as the ones created by ediff-regions-wordwise,
have eglot enabled but not buffer-file-name.  Resort to the finding
the file-name of the original buffer for these.

* eglot.el (eglot--TextDocumentIdentifier): Work in indirect
buffers.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/116
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/150

lisp/progmodes/eglot.el

index 8d3977091d9a6441c2a91496699b2d3c3bc79974..b240e0e860b21bff291e5ea625ae412a9081197a 100644 (file)
@@ -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)