开发者社区> 问答> 正文

emacs下scala开发环境配置: yasnippet, scala-mode, ensime报错

准备家伙
 
    $ cd ~/.emacs.d/
    $ wget http://yasnippet.googlecode.com/files/yasnippet-0.6.1c.tar.bz2
    $ tar -xjvf yasnippet-0.6.1c.tar.bz2
    $ ln -s yasnippet-0.6.1c yasnippet
   
    $ cp -r $SCALA_HOME/misc/scala-tool-support/emacs ~/.emacs.d/scala-mode

    $ wget https://github.com/downloads/aemoncannon/ensime/ensime_2.8.1-0.4.2.tar.gz
    $ tar -zxvf ensime_2.8.1-0.4.2.tar.gz
    $ ln -s ensime_2.8.1-0.4.2 ensime

 

配置.emacs

    $ emacs .emacs
    ;;;;添加如下代码:
    ;; yasnippet
    (add-to-list 'load-path
                  "~/.emacs.d/yasnippet")
    (require 'yasnippet) ;; not yasnippet-bundle
    (yas/initialize)
    (yas/load-directory "~/.emacs.d/yasnippet/snippets")
   
    ;; scala-mode
    (add-to-list 'load-path "~/.emacs.d/scala-mode")
    (require 'scala-mode-auto) ;; 编辑.scala文件时自动启动scala mode
   
    ;; scala yasnippet
    (setq yas/my-directory "~/.emacs.d/scala-mode/contrib/yasnippet/snippets")
    (yas/load-directory yas/my-directory)
    (add-hook 'scala-mode-hook
                '(lambda ()
                   (yas/minor-mode-on)
                   ))
                  
    ;; scala-ensime
    (add-to-list 'load-path "~/.emacs.d/ensime/elisp")
    (require 'ensime)
    (add-hook 'scala-mode-hook 'ensime-scala-mode-hook)  ;; scala mode下自动启动ensime

原文出处:http://www.douban.com/note/133904961/

展开
收起
kun坤 2020-06-14 06:40:11 760 0
1 条回答
写回答
取消 提交回答
  • 还不错。现在才知道SCALA_HOME是要设置在libexec目录的。######

    可能因为版本的问题

    ;; scala yasnippet
        (setq yas/my-directory "~/.emacs.d/scala-mode/contrib/yasnippet/snippets")
        (yas/load-directory yas/my-directory)
        (add-hook 'scala-mode-hook
                    '(lambda ()
                       (yas/minor-mode-on)

                       ))


    已经不用设置了

    =================================================
    2020-06-14 06:40:18
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
JDK8新特性与生产-for“华东地区scala爱好者聚会” 立即下载
Just Enough Scala for Spark 立即下载
From Python Scikit learn to Scala Spark 立即下载