forked from purcell/emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-clojure.el
67 lines (48 loc) · 2.43 KB
/
init-clojure.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
;; Autoloads and basic wiring
(autoload 'clojure-mode "clojure-mode" "Major mode for editing Clojure code." t nil)
(autoload 'clojure-test-mode "clojure-test-mode" "A minor mode for running Clojure tests." t nil)
(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))
(eval-after-load "clojure-mode"
'(progn
(require 'clojure-test-mode)))
;; Use technomancy's bag of fancy clojure/slime tricks
(eval-after-load "slime"
'(progn
(require 'durendal)
(durendal-enable t)))
(add-hook 'clojure-mode-hook 'enable-paredit-mode)
(defun slime-clojure-repl-setup ()
"Some REPL setup additional to that in durendal"
(when (string-equal (slime-lisp-implementation-name) "clojure")
(when (slime-inferior-process)
(message "Setting up repl for clojure")
(slime-redirect-inferior-output))
(set-syntax-table clojure-mode-syntax-table)
(setq lisp-indent-function 'clojure-indent-function)))
(add-hook 'slime-repl-mode-hook 'slime-clojure-repl-setup)
(defmacro defclojureface (name color desc &optional others)
`(defface ,name '((((class color)) (:foreground ,color ,@others))) ,desc :group 'faces))
(defclojureface clojure-parens "DimGrey" "Clojure parens")
(defclojureface clojure-braces "#49b2c7" "Clojure braces")
(defclojureface clojure-brackets "SteelBlue" "Clojure brackets")
(defclojureface clojure-keyword "khaki" "Clojure keywords")
(defclojureface clojure-java-call "#4bcf68" "Clojure Java calls")
(defclojureface clojure-special "#b8bb00" "Clojure special")
(defclojureface clojure-double-quote "#b8bb00" "Clojure special" (:background "unspecified"))
(defun tweak-clojure-syntax ()
(mapcar (lambda (x) (font-lock-add-keywords nil x))
'((("#?['`]*(\\|)" . 'clojure-parens))
(("#?\\^?{\\|}" . 'clojure-brackets))
(("\\[\\|\\]" . 'clojure-braces))
((":\\w+" . 'clojure-keyword))
(("#?\"" 0 'clojure-double-quote prepend))
(("nil\\|true\\|false\\|%[1-9]?" . 'clojure-special))
(("(\\(\\.[^ \n)]*\\|[^ \n)]+\\.\\|new\\)\\([ )\n]\\|$\\)" 1 'clojure-java-call))
)))
(add-hook 'clojure-mode-hook 'tweak-clojure-syntax)
(require 'elein)
(eval-after-load "viper"
'(add-to-list 'viper-vi-state-mode-list 'clojure-mode))
(eval-after-load "gist"
'(add-to-list 'gist-supported-modes-alist '(clojure-mode . ".clj")))
(provide 'init-clojure)