[英]emacs scala mode, cannot make it activate automatically
I add the following to my ~/emacs file 我将以下内容添加到〜/ emacs文件中
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
Installed scala-mode2 via the emacs package manager 通过emacs包管理器安装scala-mode2
Add the following to my ~/.emacs file 将以下内容添加到〜/ .emacs文件中
(add-to-list 'auto-mode-alist
'("\\.scala" . scala-mode2)
'("\\.sbt\\'" . scala-mode2)
)
I then load any scala file. 然后我加载任何scala文件。 The scala-mode has not been activated, there is no highlighting. scala-mode尚未激活,没有突出显示。
I see the following in the 'messages' buffer: 我在'messages'缓冲区中看到以下内容:
File mode specification error: (void-function scala-mode2) 文件模式规范错误:(void-function scala-mode2)
However if I enter mx scala-mode
, scala mode is activated and works just fine. 但是,如果我进入mx scala-mode
,则会激活scala模式并且工作正常。
Bad doc on github, should have been: github上的错误文档应该是:
Add the following to my ~/.emacs file 将以下内容添加到〜/ .emacs文件中
(add-to-list 'auto-mode-alist '("\.scala" . scala-mode) '("\.sbt\'" . scala-mode) )
The documentation is not very good. 文档不是很好。
I got it working by downloading the raw el files into .emacs.d/lisp/ as follows: 我通过将原始el文件下载到.emacs.d / lisp /来实现它,如下所示:
wget https://raw.githubusercontent.com/ensime/emacs-scala-mode/master/scala-mode-fontlock.el
wget https://raw.githubusercontent.com/ensime/emacs-scala-mode/master/scala-mode-imenu.el
wget https://raw.githubusercontent.com/ensime/emacs-scala-mode/master/scala-mode-indent.el
wget https://raw.githubusercontent.com/ensime/emacs-scala-mode/master/scala-mode-lib.el
wget https://raw.githubusercontent.com/ensime/emacs-scala-mode/master/scala-mode-map.el
wget https://raw.githubusercontent.com/ensime/emacs-scala-mode/master/scala-mode-paragraph.el
wget https://raw.githubusercontent.com/ensime/emacs-scala-mode/master/scala-mode-prettify-symbols.el
wget https://raw.githubusercontent.com/ensime/emacs-scala-mode/master/scala-mode-prettify-syntax.el
wget https://raw.githubusercontent.com/ensime/emacs-scala-mode/master/scala-mode-syntax.el
wget https://raw.githubusercontent.com/ensime/emacs-scala-mode/master/scala-mode.el
Then just enable the mode by adding the following in .emacs: 然后通过在.emacs中添加以下内容来启用该模式:
(require 'scala-mode)
(add-to-list 'auto-mode-alist '("\\.scala$" . scala-mode))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.