Ensime劣质scala模式

时间:2013-03-25 20:28:40

标签: scala emacs slime ensime

我为scala设置了Emacs + Ensime。

我可以使用C-c C-v s在emacs中启动sbt控制台

如果我使用C-c C-v z在emacs内启动scala控制台,我会收到以下错误

Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_33).
scala> 
Failed to initialize compiler: class scala.reflect.BeanInfo not found

此错误的修复方法是什么?如何在Emacs中运行scala控制台?

1 个答案:

答案 0 :(得分:0)

我最近遇到了类似的错误,但这是我如何解决它(但我不知道如何解决它,所以这只是答案的一半)。我所做的是自定义ensime-inf-default-cmd-line变量以获得值'("sbt" "console")。这将确实启动交互式Scala环境。

编辑:

以下是.emacs的相关部分,但我不确定它是否重要/每次安装都相同:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 ;;
 ;; more stuff ...
 ;; I'm not sure this line is correct / makes any difference
 '(ensime-inf-cmd-template (quote ("sbt" "console" "-classpath" :classpath)))
 ;; This variable is used to launch the interpreter
 '(ensime-inf-default-cmd-line (quote ("sbt" "console"))))

(require 'scala-mode2)
(add-to-list 'auto-mode-alist '("\\.scala$" . scala-mode))
(add-to-list 'load-path "~/.emacs.d/ensime/elisp/")
(require 'ensime)
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)

我已经从MELPA安装了scala-mode2。通过从其站点下载RPM来安装sbt版本0.12.0。我之前安装了JRE和JDK,活动版本是OpenJDK 1.7。安装的Scala是2.9.2。我不知道如何识别Ensime的版本:|