简体   繁体   English

设置emacs的环境路径以使用ensime运行Scala

[英]Setting environment path for emacs for running scala with ensime

I was trying to run ensime for emacs. 我试图为Emacs运行ensime。 Here is the the init.el - https://github.com/michaelpnash/emacs-for-scala/blob/master/.emacs.d/init.el 这是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. require ensime行之前我添加了sbt和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 - 在〜/ .sbt / plugins.sbt中,我有以下代码段-

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 我克隆了一个样本样板-git clone git://github.com/dph01/scala-sbt-template.git

and then sbt "ensime generate" 然后sbt产生“动漫”

It runs well, but while I open emacs it gives me an error - 它运行良好,但是当我打开emacs时却出现了一个错误-

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))]

you're using an ancient version of ensime-sbt . 您正在使用ensime-sbtensime-sbt版本。 Start again by installing it following these instructions https://github.com/ensime/ensime-sbt 按照以下说明重新安装,以重新开始https://github.com/ensime/ensime-sbt

Add the following to your init.el (after calling package-initialize): 将以下内容添加到您的init.el (在调用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. 如果要始终从外壳加载路径,则可能要删除对mac的检查。

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

Also see: 另请参阅:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM