branch: externals/eglot
commit a1f20331f3ecd9c8c2e92482103f17eb30adab01
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>

    Fix #116, #150: don't break in indirect buffers
    
    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.
---
 eglot.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/eglot.el b/eglot.el
index 8d39770..b240e0e 100644
--- a/eglot.el
+++ b/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)
 

Reply via email to