How can I connect to an ensime server on a remote host? My netbook is a bit slow for that kind of stuff. I copied the data over and use tramp to edit the files remotely. I ran bin/server
to create the server and an ssh forwarding to be able to connect to it. I use ensime-connect
to connect to the port on localhost. The ensime server on the remote server answers with Got connection, creating handler...
, but that's about it. Ensime is in [ENSIME: wtf]
mode in the emacs status line. How do I fix this?
Asked
Active
Viewed 1,175 times
10

Reactormonk
- 21,472
- 14
- 74
- 123
-
Do you have the source files in the same directory on the client and on the server? – Kim Stebel Nov 18 '12 at 16:35
-
Not in terms of absolute path, but the same one relative to `$HOME`. – Reactormonk Nov 18 '12 at 20:28
-
don't think that will help you – Kim Stebel Nov 18 '12 at 21:26
-
The `.ensime` had absolute paths. I changed them, but I don't know how to point `ensime` on the remote server to the new conf. – Reactormonk Nov 18 '12 at 22:06
1 Answers
3
The problem is the ensime can not find "config" of the connection (made through ensime-connect).
and then following line will throws error:
(if (and loose (ensime-file-in-directory-p file project-root))
because project-root is nil.
By setting the connection to ensime-buffer-connection, the problem can be fixed. try adding following function to your ensime.el
and using the ensime-stackoverflow-connect
to connect.
(defun ensime-stackoverflow-connect (host port)
(interactive (list
(read-from-minibuffer "Host: " ensime-default-server-host)
(read-from-minibuffer "Port: " (format "%d" ensime-default-port)
nil t)))
(let ((c (ensime-connect host port))
(config (ensime-config-load "/Users/whunmr/lab/scala/.ensime")))
(ensime-set-config c config)
(setq ensime-buffer-connection c))
)
remember to change the config path in the code: "/Users/whunmr/lab/scala/.ensime"
EDIT1: the ".ensime" file was created by M-x ensime command, in your scala project folder. actually, by just hardcode the config, you can ignore the file.
(defun ensime-my-connection (host port)
(interactive (list
(read-from-minibuffer "Host: " ensime-default-server-host)
(read-from-minibuffer "Port: " (format "%d" ensime-default-port)
nil t)))
(let ((c (ensime-connect host port))
(config '(:project-name "test" :project-package "com.whunmr" :sources ("./src") :compile-jars ("./" "../../apps/scala/lib/") :target "./bin" :root-dir "/Users/twer/lab/scala/")))
(ensime-set-config c config)
(setq ensime-buffer-connection c))
)

whunmr
- 2,435
- 2
- 22
- 35
-
-
-
Wouldn't it be possible to partially read the config from e.g. the tramp connection? – Reactormonk Dec 05 '12 at 06:59
-
I think it can be read through tramp connection. just specify your .ensime url like "
@ – whunmr Dec 05 '12 at 07:13:/Users/... .../.ensime" -
try first open the .ensime file through tramp mode. then connect. to see if it will read properly. if it not works, i think, need hard code the config. – whunmr Dec 05 '12 at 07:19
-
let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/20605/discussion-between-tass-and-whunmr) – Reactormonk Dec 05 '12 at 07:25