目次
はじめに
以前Clojure開発環境を作ってみたことがありますが,
今回はパッケージからインストールしてみます.
環境とバージョン
- OS:Debian Jessie amd64
- Emacs:24.3
インストール
Emacsを起動し,
M-x package-list-packages
と打ちます.
パッケージリストから,
auto-complete
clojure-mode
clojure-test-mode
nrepl
nrepl-ritz
ac-nrepl
paredit
rainbow-delimiters
を選択しインストールします.
設定
初期設定ファイル(.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.
'(auto-save-default nil)
'(backup-inhibited t t)
'(cursor-type 'bar t)
'(column-number-mode t)
'(delete-selection-mode t)
'(inhibit-startup-screen t)
'(initial-scratch-message nil)
'(tool-bar-mode nil)
'(xterm-mouse-mode 1))
;; rainbow delimiters
(require 'rainbow-delimiters)
(global-rainbow-delimiters-mode)
;; paredit
(add-hook 'clojure-mode-hook 'paredit-mode)
(add-hook 'nrepl-mode-hook 'paredit-mode)
(global-set-key [f7] 'paredit-mode)
;; clojure-mode
(global-set-key [f9] 'nrepl-jack-in)
;; nrepl
(add-hook 'nrepl-interaction-mode-hook 'nrepl-turn-on-eldoc-mode)
(setq nrepl-popup-stacktraces nil)
(add-to-list 'same-window-buffer-names "*nrepl*")
(add-hook 'nrepl-mode-hook 'paredit-mode)
;; nrepl-ritz
(add-hook 'nrepl-interaction-mode-hook 'my-nrepl-mode-setup)
(defun my-nrepl-mode-setup ()
(require 'nrepl-ritz))
;; Auto complete
(require 'auto-complete-config)
(ac-config-default)
(define-key ac-completing-map "\M-/" 'ac-stop)
;; ac-nrepl
(require 'ac-nrepl)
(add-hook 'nrepl-mode-hook 'ac-nrepl-setup)
(add-hook 'nrepl-interaction-mode-hook 'ac-nrepl-setup)
(eval-after-load "auto-complete" '(add-to-list 'ac-modes 'nrepl-mode))
#CTRL-D to finish
参考リンク
Vagrant / Clojure / Emacs – Stack Overflow
World Cognition By Programming: Setting up Emacs for Clojure programming
- 以前の記事はコチラ.