emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 0bfba49ca7c: Robustify Eglot for "transient" projects


From: João Távora
Subject: emacs-29 0bfba49ca7c: Robustify Eglot for "transient" projects
Date: Sat, 4 Mar 2023 07:47:19 -0500 (EST)

branch: emacs-29
commit 0bfba49ca7cf90e841c076d6db9bb3826e7b6a57
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Robustify Eglot for "transient" projects
    
    When Eglot needs to synthesize a "transient" project for
    default-directory sometimes the value of that variable is set to an
    unexpanded value, sometimes not.  This can cause simple invocations
    like.
    
       Emacs -Q ~/path/to-some-python-file.py -f eglot
    
    to fail, because eglot--current-server will be looking for a project
    in the registry called
    
        (transient . "~/path")
    
    where in reality it is stored there as
    
        (transient . "/home/someuser/path")
    
    The fix is to always expand default-directory in eglot--current-project.
    
    * lisp/progmodes/eglot.el (eglot--current-project): Use
    expand-file-name.
---
 lisp/progmodes/eglot.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index c74b13d3380..1f213d4e254 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1079,7 +1079,8 @@ variable (which see) can query the value 
`eglot-lsp-context' to
 decide whether a given directory is a project containing a
 suitable root directory for a given LSP server's purposes."
   (let ((eglot-lsp-context t))
-    (or (project-current) `(transient . ,default-directory))))
+    (or (project-current)
+        `(transient . ,(expand-file-name default-directory)))))
 
 ;;;###autoload
 (defun eglot (managed-major-mode project class contact language-id



reply via email to

[Prev in Thread] Current Thread [Next in Thread]