Setting environment path for emacs for running scala with ensime

329 Views Asked by At

I was trying to run ensime for emacs. Here is the the init.el - https://github.com/michaelpnash/emacs-for-scala/blob/master/.emacs.d/init.el

Before the require ensime line I add the Path for sbt and scala.

(setenv "PATH" (concat "/usr/local/bin/scala:" (getenv "PATH")))
(setenv "PATH" (concat "/usr/local/bin/sbt:" (getenv "PATH")))



$ which sbt
/usr/local/bin/sbt
$ which scala
/usr/local/bin/scala

In ~/.sbt/plugins.sbt I have the following snippet -

resolvers += Resolver.sonatypeRepo("snapshots")

addSbtPlugin("org.ensime" % "ensime-sbt" % "0.1.6")

I clone a sample boilerplate - git clone git://github.com/dph01/scala-sbt-template.git

and then sbt "ensime generate"

It runs well, but while I open emacs it gives me an error -

check that set is on your PATH and that your config is compatible with github.com/ensime/ensime-server/wiki/Example-Configuration-File [(error Error reading configuration file, : (end-of-file))]
2

There are 2 best solutions below

0
On

Add the following to your init.el (after calling package-initialize):

(when (memq window-system '(mac ns)) 
  (exec-path-from-shell-initialize))

You may want to remove the check for mac if you want to load the path from shell always.

https://github.com/purcell/exec-path-from-shell

Also see:

https://github.com/ensime/ensime-emacs/issues/225

https://github.com/ensime/ensime-server/issues/670

0
On

you're using an ancient version of ensime-sbt. Start again by installing it following these instructions https://github.com/ensime/ensime-sbt