我将以下内容添加到〜/ emacs文件
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
通过emacs包管理器安装scala-mode2
将以下内容添加到我的〜/ .emacs文件
(add-to-list 'auto-mode-alist
'("\\.scala" . scala-mode2)
'("\\.sbt\\'" . scala-mode2)
)
然后我加载任何scala文件。 scala-mode尚未激活,没有突出显示。
我在'messages'缓冲区中看到以下内容:
文件模式指定错误:(void-function scala-mode2)
但是,如果我输入m-x scala-mode
,则会激活scala模式并且工作正常。
答案 0 :(得分:2)
github上的错误文档应该是:
将以下内容添加到我的〜/ .emacs文件
(add-to-list 'auto-mode-alist '("\.scala" . scala-mode) '("\.sbt\'" . scala-mode) )
答案 1 :(得分:0)
文档不是很好。
我通过将原始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
然后只需在.emacs中添加以下内容即可启用该模式:
(require 'scala-mode)
(add-to-list 'auto-mode-alist '("\\.scala$" . scala-mode))