原文地址
为了学习Clojure,我最近特别在windows下配置了基于Emacs的Clojure开发环境。把过程做个记录,跟大家分享一下。过程不算太复杂,关键是要多使用Google来解决问题,有些版本问题比较难解决,耐心多尝试就能成功。很多同学都说使用linux更合适等等,我觉得确实有道理,但windows毕竟是很多程序员每天工作必用的工具,使用起来方便的多,所以还是有必要折腾一把。
lein plugin install swank-clojure 1.4.0回车
lein会自动下载相关依赖并安装swank-clojure
至此,lein安装完毕
(add-to-list 'load-path "~/.emacs.d/clojure-mode")
1 (add-to-list 'load-path "~/.emacs.d")
2 (add-to-list 'load-path "~/.emacs.d/clojure-mode")
3 (add-to-list 'load-path "~/.emacs.d/color-theme")
4 (add-to-list 'load-path "~/.emacs.d/auto-complete")
5
6 (require 'clojure-mode)
7
8 (require 'color-theme)
9 (color-theme-initialize)
10 (color-theme-xemacs)
11
12 (require 'auto-complete-config)
13 (ac-config-default)
14 (add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/dict")
15
16 (autoload 'paredit-mode "paredit"
17 "Minor mode for pseudo-structurally editing Lisp code." t)
18 (add-hook 'emacs-lisp-mode-hook (lambda () (paredit-mode +1)))
19 (add-hook 'lisp-mode-hook (lambda () (paredit-mode +1)))
20 (add-hook 'lisp-interaction-mode-hook (lambda () (paredit-mode +1)))
21 (add-hook 'scheme-mode-hook (lambda () (paredit-mode +1)))
22 (add-hook 'clojure-mode-hook (lambda () (paredit-mode +1)))
23 (add-hook 'slime-repl-mode-hook (lambda () (paredit-mode +1)))
24 (defun override-slime-repl-bindings-with-paredit ()
25 (define-key slime-repl-mode-map
26 (read-kbd-macro paredit-backward-delete-key) nil))
27 (add-hook 'slime-repl-mode-hook 'override-slime-repl-bindings-with-paredit)
28
29 (custom-set-variables
30 ;; custom-set-variables was added by Custom.
31 ;; If you edit it by hand, you could mess it up, so be careful.
32 ;; Your init file should contain only one such instance.
33 ;; If there is more than one, they won't work right.
34 '(tool-bar-mode nil))
35 (custom-set-faces
36 ;; custom-set-faces was added by Custom.
37 ;; If you edit it by hand, you could mess it up, so be careful.
38 ;; Your init file should contain only one such instance.
39 ;; If there is more than one, they won't work right.
40 '(default ((t (:inherit nil :stipple nil :background "gray80" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 113 :width normal :foundry "outline" :family "Consolas")))))
41
42 (show-paren-mode 1)
43 (setq visible-bell nil)
44 (setq scroll-step 1
45 scroll-margin 3
46 scroll-conservatively 10000)
47 (global-linum-mode 'linum-mode) ;
48 (set-scroll-bar-mode nil) ;去掉滚动条
49 (auto-save-mode nil) ;;禁止自动保存
50 (global-set-key (kbd "C-|") 'other-window);
51 (setq frame-title-format
52 '("%S" (buffer-file-name "%f"
53 (dired-directory dired-directory "%b"))))
1 (defproject SwankProject "1.0.0-SNAPSHOT"
2 :description "FIXME: write description"
3 :dependencies [[org.clojure/clojure "1.3.0"]
4 [org.clojure/clojure-contrib "1.2.0"]])