From 2b071ccba5c4f88fd0a66c505110d5081d695631 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Thu, 28 Jun 2018 23:30:39 +0100 Subject: [PATCH] Bind default-directory when launching servers Apparently, not doing so trips some servers, like Scala's. * eglot.el (eglot--connect): Bind default-directory. GitHub-reference: close https://github.com/joaotavora/eglot/issues/33 --- lisp/progmodes/eglot.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 01658f9343e..50733f74581 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -448,8 +448,8 @@ INTERACTIVE is t if called interactively." (defun eglot--connect (managed-major-mode project class contact) "Connect to MANAGED-MAJOR-MODE, PROJECT, CLASS and CONTACT. This docstring appeases checkdoc, that's all." - (let* ((nickname (file-name-base (directory-file-name - (car (project-roots project))))) + (let* ((default-directory (car (project-roots project))) + (nickname (file-name-base (directory-file-name default-directory))) (readable-name (format "EGLOT (%s/%s)" nickname managed-major-mode)) autostart-inferior-process (initargs @@ -504,10 +504,8 @@ This docstring appeases checkdoc, that's all." :initialize (list :processId (unless (eq (jsonrpc-process-type server) 'network) (emacs-pid)) - :rootPath (expand-file-name - (car (project-roots project))) - :rootUri (eglot--path-to-uri - (car (project-roots project))) + :rootPath (expand-file-name default-directory) + :rootUri (eglot--path-to-uri default-directory) :initializationOptions (eglot-initialization-options server) :capabilities (eglot-client-capabilities server))) (setf (eglot--capabilities server) capabilities) -- 2.39.2