-
Notifications
You must be signed in to change notification settings - Fork 0
/
.emacs
236 lines (184 loc) · 7.04 KB
/
.emacs
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
(add-to-list 'load-path "~/.emacs.d/")
(add-to-list 'load-path "~/elisp")
(global-font-lock-mode t)
(shell)
(process-kill-without-query (get-process "shell"))
(setq x-select-enable-clipboard t)
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(require 'tramp)
(setq tramp-default-method "ssh")
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
;; -----------------------------------
;; unicode
;; -----------------------------------
(message "Setting UTF-8 encoding")
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
;; -----------------------------------
;; package.el
;; -----------------------------------
(when
(load
(expand-file-name "~/.emacs.d/elpa/package.el"))
(package-initialize))
(require 'paredit)
(require 'highlight-parentheses)
;; -----------------------------------
;; git
;; -----------------------------------
(progn
(setq egg-dir "~/elisp/egg")
(load-file (format "%s/egg.el" egg-dir))
(require 'egg))
;; -----------------------------------
;; irc
;; -----------------------------------
(add-to-list 'load-path "~/elisp/erc")
(require 'erc)
(require 'erc-match)
(setq erc-keywords '("sayem"))
(setq erc-autojoin-channels-alist '((".*" "#rubyonrails" "#ruby" "#javascript" "#iosdev" "#iphonedev" "#iphone")))
;; -----------------------------------
;; ido
;; -----------------------------------
(require 'ido)
(ido-mode t)
(setq ido-enable-flex-matching t)
;; ----------------------------------
;; lisp
;; ----------------------------------
;; scheme
;; -----------------
(load-file "~/elisp/geiser/elisp/geiser.el")
(setq geiser-racket-binary "~/bin/racket")
(setq geiser-active-implementations '(racket))
(defun scheme-custom-setup ()
(highlight-parentheses-mode)
(paredit-mode))
(add-hook 'scheme-mode-hook 'scheme-custom-setup)
(add-hook 'inferior-scheme-mode-hook 'scheme-custom-setup)
;; elisp
;; -----------------
(defun elisp-custom-setup ()
(font-lock-add-keywords nil '(("(\\|)" . 'paren-face)))
(highlight-parentheses-mode)
(paredit-mode))
(add-hook 'emacs-lisp-mode-hook 'elisp-custom-setup)
;; ----------------------------------
;; c, c++
;; ----------------------------------
(require 'cc-mode)
(global-set-key [(f9)] 'compile)
(setq compilation-window-height 8)
(setq compilation-finish-function
(lambda (buf str)
(if (string-match "exited abnormally" str)
;;there were errors
(message "compilation errors, press C-x ` to visit")
;;no errors, make the compilation window go away in 0.5 seconds
(run-at-time 0.5 nil 'delete-windows-on buf)
(message "NO COMPILATION ERRORS!"))))
(add-to-list 'auto-mode-alist '("\\.mm\\'" . objc-mode))
(add-to-list 'magic-mode-alist
`(,(lambda ()
(and (string= (file-name-extension buffer-file-name) "h")
(re-search-forward "@\\<interface\\>"
magic-mode-regexp-match-limit t)))
. objc-mode))
;; -----------------------------------
;; rails
;; -----------------------------------
(add-to-list 'load-path "~/elisp/rinari")
(require 'rinari)
(require 'haml-mode)
(add-to-list 'load-path "~/elisp/rails-minor-mode")
(require 'rails)
(defun try-complete-abbrev (old)
(if (expand-abbrev) t nil))
(setq hippie-expand-try-functions-list
'(try-complete-abbrev
try-complete-file-name
try-expand-dabbrev))
(setq save-abbrevs 'silently)
(require 'ruby-block)
(ruby-block-mode t)
(setq ruby-block-highlight-toggle 'overlay)
(add-to-list 'load-path "~/elisp/rhtml")
(require 'rhtml-mode)
(require 'slim-mode)
(add-hook 'rhtml-mode-hook
(lambda () (rinari-launch)))
(add-to-list 'auto-mode-alist '("\\.rhtml" . html-mode))
(add-hook 'ruby-mode-hook 'customize-ruby)
(setq ruby-insert-encoding-magic-comment nil)
;; -----------------------------------
;; web dev
;; -----------------------------------
(add-to-list 'load-path "~/elisp/web-mode.el")
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.inc\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.haml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.hbs\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.handlebars\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.eco\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.ejs\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsx\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.cjsx\\'" . web-mode))
(add-to-list 'load-path "~/elisp/jade-mode")
(require 'sws-mode)
(require 'jade-mode)
(add-to-list 'auto-mode-alist '("\\.styl$" . sws-mode))
(add-to-list 'auto-mode-alist '("\\.jade$" . jade-mode))
(add-to-list 'load-path "~/elisp/rainbow-mode.el")
(require 'rainbow-mode)
(add-to-list 'load-path "~/elisp/less-css-mode.el")
(require 'less-css-mode)
(defun all-css-modes() (css-mode) (rainbow-mode))
(add-to-list 'auto-mode-alist '("\\.css$" . all-css-modes))
;; -----------------------------------
;; javascript
;; -----------------------------------
(autoload 'espresso-mode "espresso")
(add-to-list 'load-path "~/elisp/moz.el")
(autoload 'moz-minor-mode "moz" "Mozilla Minor and Inferior Mozilla Modes" t)
(add-to-list 'load-path "~/elisp/coffee-mode.el")
(require 'coffee-mode)
(add-to-list 'auto-mode-alist '("\\.cjsx\\'" . coffee-mode))
(setq js-indent-level 2)
;; ------------------------------------------------------------------
(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.
'(confirm-kill-emacs nil)
'(global-auto-revert-mode t)
'(global-auto-revert-non-file-buffers t)
'(inhibit-startup-screen t))
(custom-set-faces
;; custom-set-faces 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.
'(default ((t (:inherit nil :stipple nil :background "black" :foreground "green" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))
;;; This was installed by package-install.el.
;;; This provides support for the package system and
;;; interfacing with ELPA, the package archive.
;;; Move this code earlier if you want to reference
;;; packages in your .emacs.
(when
(load
(expand-file-name "~/.emacs.d/elpa/package.el"))
(package-initialize))