]> git.eshelyaron.com Git - emacs.git/commitdiff
Bind default-directory when launching servers
authorJoão Távora <joaotavora@gmail.com>
Thu, 28 Jun 2018 22:30:39 +0000 (23:30 +0100)
committerJoão Távora <joaotavora@gmail.com>
Fri, 29 Jun 2018 23:29:14 +0000 (00:29 +0100)
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

index 01658f9343ea63814e0499ce4abceb900f8b4657..50733f74581aed84ab74b7bf1b1171209001f169 100644 (file)
@@ -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)