]> git.rkrishnan.org Git - .emacs.d.git/blob - init.el
add magit
[.emacs.d.git] / init.el
1 (show-paren-mode 1)
2 ;; y-or-n instead of yes-or-no
3 (defalias 'yes-or-no-p 'y-or-n-p)
4
5 ;; Don't use messages that you don't rea
6 (setq make-backup-files nil)
7 (setq initial-scratch-message "")
8 (setq inhibit-startup-message t)
9
10 ;; cursor bar
11 (setq-default cursor-type '(bar . 2))
12
13 ;; column number
14 (column-number-mode 1)
15
16 ;; font
17 ;; (set-default-font "Inconsolata-12")
18
19 ;; Don't let Emacs hurt your ears
20 (setq visible-bell t)
21
22 ;; This is bound to f11 in Emacs 24.4
23 ;; (toggle-frame-fullscreen)
24 (custom-set-variables
25  ;; custom-set-variables was added by Custom.
26  ;; If you edit it by hand, you could mess it up, so be careful.
27  ;; Your init file should contain only one such instance.
28  ;; If there is more than one, they won't work right.
29  '(haskell-process-auto-import-loaded-modules t)
30  '(haskell-process-log t)
31  '(haskell-process-suggest-remove-import-lines t)
32  '(haskell-process-type (quote cabal-repl))
33  '(initial-frame-alist (quote ((fullscreen . maximized))))
34  '(send-mail-function (quote smtpmail-send-it)))
35 ;; Who use the bar to scroll?
36 (when (display-graphic-p)
37   (progn
38     (scroll-bar-mode 0)
39
40     (tool-bar-mode 0)
41     (menu-bar-mode 0)))
42
43 ; my-packages.el
44 (require 'package)
45 (add-to-list 'package-archives
46              '("melpa" . "http://melpa.milkbox.net/packages/") t)
47 (add-to-list 'package-archives
48              '("marmalade" . "http://marmalade-repo.org/packages/") t)
49 (package-initialize)
50
51 ; fetch the list of packages available
52 (unless package-archive-contents
53   (package-refresh-contents))
54
55 ;; make sure my list of packages are installed
56 (setq package-list '(go-mode
57                      rust-mode
58                      haskell-mode
59                      ghc
60                      restclient
61                      tangotango-theme
62                      fill-column-indicator
63                      paredit
64                      leuven-theme
65                      notmuch
66                      railscasts-theme
67                      racket-mode
68                      auto-complete
69                      magit))
70
71 ; install the missing packages
72 (dolist (package package-list)
73   (unless (package-installed-p package)
74     (package-install package)))
75
76 ;; tangotango
77 ;; (load-theme 'tangotango t)
78 ;; (load-theme 'railscasts t)
79 ;; (load-theme 'leuven t)
80
81 ;; erc
82 (require 'erc)
83 (require 'tls)
84 ;; (setq tls-program '("openssl s_client -connect %h:%p -no_ssl2 -ign_eof"))
85
86 (erc-autojoin-mode t)
87 (setq erc-autojoin-channels-alist
88   '((".*\\.freenode.net" "#tahoe-lafs" "#plan9chan" "#cat-v")
89     (".*\\.oftc.net" "#LeastAuthority")))
90
91 ;; check channels
92 (erc-track-mode t)
93 (setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
94
95                                  "324" "329" "332" "333" "353" "477"))
96 ;; don't show any of this
97 (setq erc-hide-list '("JOIN" "PART" "QUIT" "NICK"))
98
99 (defun start-erc ()
100   "Connect to IRC."
101   (interactive)
102   (when (y-or-n-p "Do you want to start IRC? ")
103     (erc-tls :server "irc.freenode.net" :port 6697 :nick "rkrishnan" :full-name "Ramakrishnan Muthukrishnan")
104     (erc-tls :server "irc.oftc.net" :port 6697 :nick "rkrishnan" :full-name "Ramakrishnan Muthukrishnan")))
105
106 ;; switch to ERC with Ctrl+c e
107 (global-set-key (kbd "C-c e") 'start-erc) ;; ERC
108
109 ;; haskell mode
110 (setenv "PATH" (concat "~/.cabal/bin:" (getenv "PATH")))
111 (add-to-list 'exec-path "~/.cabal/bin")
112 (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
113 ;; (add-hook 'haskell-mode-hook 'haskell-indent-mode)
114 ;; (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
115 ;(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
116 (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
117
118 ;; haskell mode
119 (require 'haskell-interactive-mode)
120 (require 'haskell-process)
121 (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
122
123
124
125 (eval-after-load "haskell-mode"
126   '(progn
127      (define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload)
128      (define-key haskell-mode-map (kbd "C-`") 'haskell-interactive-bring)
129      (define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
130      (define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
131      (define-key haskell-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
132      (define-key haskell-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)
133      (define-key haskell-mode-map (kbd "C-c c") 'haskell-process-cabal)
134      (define-key haskell-mode-map (kbd "SPC") 'haskell-mode-contextual-space)
135
136      (define-key haskell-cabal-mode-map (kbd "C-`") 'haskell-interactive-bring)
137      (define-key haskell-cabal-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)
138      (define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
139      (define-key haskell-cabal-mode-map (kbd "C-c c") 'haskell-process-cabal)))
140
141 ;; ghc-mod
142 (autoload 'ghc-init "ghc" nil t)
143 (autoload 'ghc-debug "ghc" nil t)
144 (setq ghc-debug t)
145 (add-hook 'haskell-mode-hook (lambda () (ghc-init)))
146
147
148 ;; ido
149 (setq ido-enable-flex-matching t)
150 (setq ido-everywhere t)
151 (ido-mode 1)
152
153 ;; disable tabs for indentation
154 (setq-default indent-tabs-mode nil)
155
156 ;; (require 'whitespace)
157 ;; (setq whitespace-style '(face lines-tail))
158 ;; (setq whitespace-line-column 80)
159 ;; (global-whitespace-mode t)
160
161 ;; ;; show trailing whitespaces
162 ;; (setq-default show-trailing-whitespace t)
163 ;; (setq-default indicate-empty-lines t)
164
165 ;; C style
166 (setq c-default-style "k&r"
167       c-basic-offset 4)
168
169 ;; hlint
170 (add-to-list 'load-path "~/.emacs.d/hs-lint")
171 (require 'hs-lint)
172 (defun my-haskell-mode-hook ()
173    (local-set-key "\C-cl" 'hs-lint))
174 (add-hook 'haskell-mode-hook 'my-haskell-mode-hook)
175
176 ;; gofmt
177 (add-hook 'before-save-hook #'gofmt-before-save)
178 (add-hook 'go-mode-hook (lambda ()
179                           (local-set-key (kbd "C-c C-r")
180                                          'go-remove-unused-imports)))
181 (add-hook 'go-mode-hook (lambda ()
182                           (local-set-key (kbd "C-c i")
183                                          'go-goto-imports)))
184
185 ;; asp
186 (add-to-list 'load-path "~/.emacs.d/asp-mode")
187 (autoload 'asp-mode "asp-mode")
188 (setq auto-mode-alist
189       (cons '("\\.asp\\'" . asp-mode) auto-mode-alist))
190
191 ;; line-number-mode
192 (global-linum-mode t)
193 (global-hl-line-mode 0)
194
195 ;; fci -- fill-column-indicator
196 (setq fci-rule-column 81)
197 (setq fci-rule-width 1)
198 (setq fci-rule-color "darkblue")
199
200 ;; turn off electric-indent-mode
201 (when (fboundp 'electric-indent-mode) (electric-indent-mode -1))
202
203 ;; notmuch
204 (setq mail-user-agent 'message-user-agent)
205 (setq user-mail-address "ram@rkrishnan.org"
206       user-full-name "Ramakrishnan Muthukrishnan")
207
208 ;; smtp
209 (setq smtpmail-stream-type 'ssl
210       smtpmail-smtp-server "mail.messagingengine.com"
211       smtpmail-smtp-service 465)
212
213 ;; addressbook
214 (require 'notmuch-address)
215 (setq notmuch-address-command "/usr/bin/notmuch-addrlookup")
216 (notmuch-address-message-insinuate)
217
218 (require 'smtpmail)
219 (setq message-send-mail-function 'smtpmail-send-it)
220 (require 'starttls)
221
222 ;; sign all emails
223 (add-hook 'message-setup-hook 'mml-secure-message-sign-pgp)
224
225 (custom-set-faces
226  ;; custom-set-faces was added by Custom.
227  ;; If you edit it by hand, you could mess it up, so be careful.
228  ;; Your init file should contain only one such instance.
229  ;; If there is more than one, they won't work right.
230  )
231
232 ;; auto complete
233 (ac-config-default)
234