]> git.rkrishnan.org Git - .emacs.d.git/blob - init.el
auto-complete, racket-mode, but without loading any colour theme
[.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
70 ; install the missing packages
71 (dolist (package package-list)
72   (unless (package-installed-p package)
73     (package-install package)))
74
75 ;; tangotango
76 ;; (load-theme 'tangotango t)
77 ;; (load-theme 'railscasts t)
78 ;; (load-theme 'leuven t)
79
80 ;; erc
81 (require 'erc)
82 (require 'tls)
83 ;; (setq tls-program '("openssl s_client -connect %h:%p -no_ssl2 -ign_eof"))
84
85 (erc-autojoin-mode t)
86 (setq erc-autojoin-channels-alist
87   '((".*\\.freenode.net" "#tahoe-lafs" "#plan9chan" "#cat-v")
88     (".*\\.oftc.net" "#LeastAuthority")))
89
90 ;; check channels
91 (erc-track-mode t)
92 (setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
93
94                                  "324" "329" "332" "333" "353" "477"))
95 ;; don't show any of this
96 (setq erc-hide-list '("JOIN" "PART" "QUIT" "NICK"))
97
98 (defun start-erc ()
99   "Connect to IRC."
100   (interactive)
101   (when (y-or-n-p "Do you want to start IRC? ")
102     (erc-tls :server "irc.freenode.net" :port 6697 :nick "rkrishnan" :full-name "Ramakrishnan Muthukrishnan")
103     (erc-tls :server "irc.oftc.net" :port 6697 :nick "rkrishnan" :full-name "Ramakrishnan Muthukrishnan")))
104
105 ;; switch to ERC with Ctrl+c e
106 (global-set-key (kbd "C-c e") 'start-erc) ;; ERC
107
108 ;; haskell mode
109 (setenv "PATH" (concat "~/.cabal/bin:" (getenv "PATH")))
110 (add-to-list 'exec-path "~/.cabal/bin")
111 (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
112 ;; (add-hook 'haskell-mode-hook 'haskell-indent-mode)
113 ;; (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
114 ;(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
115 (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
116
117 ;; haskell mode
118 (require 'haskell-interactive-mode)
119 (require 'haskell-process)
120 (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
121
122
123
124 (eval-after-load "haskell-mode"
125   '(progn
126      (define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload)
127      (define-key haskell-mode-map (kbd "C-`") 'haskell-interactive-bring)
128      (define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
129      (define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
130      (define-key haskell-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
131      (define-key haskell-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)
132      (define-key haskell-mode-map (kbd "C-c c") 'haskell-process-cabal)
133      (define-key haskell-mode-map (kbd "SPC") 'haskell-mode-contextual-space)
134
135      (define-key haskell-cabal-mode-map (kbd "C-`") 'haskell-interactive-bring)
136      (define-key haskell-cabal-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)
137      (define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
138      (define-key haskell-cabal-mode-map (kbd "C-c c") 'haskell-process-cabal)))
139
140 ;; ghc-mod
141 (autoload 'ghc-init "ghc" nil t)
142 (autoload 'ghc-debug "ghc" nil t)
143 (setq ghc-debug t)
144 (add-hook 'haskell-mode-hook (lambda () (ghc-init)))
145
146
147 ;; ido
148 (setq ido-enable-flex-matching t)
149 (setq ido-everywhere t)
150 (ido-mode 1)
151
152 ;; disable tabs for indentation
153 (setq-default indent-tabs-mode nil)
154
155 ;; (require 'whitespace)
156 ;; (setq whitespace-style '(face lines-tail))
157 ;; (setq whitespace-line-column 80)
158 ;; (global-whitespace-mode t)
159
160 ;; ;; show trailing whitespaces
161 ;; (setq-default show-trailing-whitespace t)
162 ;; (setq-default indicate-empty-lines t)
163
164 ;; C style
165 (setq c-default-style "k&r"
166       c-basic-offset 4)
167
168 ;; hlint
169 (add-to-list 'load-path "~/.emacs.d/hs-lint")
170 (require 'hs-lint)
171 (defun my-haskell-mode-hook ()
172    (local-set-key "\C-cl" 'hs-lint))
173 (add-hook 'haskell-mode-hook 'my-haskell-mode-hook)
174
175 ;; gofmt
176 (add-hook 'before-save-hook #'gofmt-before-save)
177 (add-hook 'go-mode-hook (lambda ()
178                           (local-set-key (kbd "C-c C-r")
179                                          'go-remove-unused-imports)))
180 (add-hook 'go-mode-hook (lambda ()
181                           (local-set-key (kbd "C-c i")
182                                          'go-goto-imports)))
183
184 ;; asp
185 (add-to-list 'load-path "~/.emacs.d/asp-mode")
186 (autoload 'asp-mode "asp-mode")
187 (setq auto-mode-alist
188       (cons '("\\.asp\\'" . asp-mode) auto-mode-alist))
189
190 ;; line-number-mode
191 (global-linum-mode t)
192 (global-hl-line-mode 0)
193
194 ;; fci -- fill-column-indicator
195 (setq fci-rule-column 81)
196 (setq fci-rule-width 1)
197 (setq fci-rule-color "darkblue")
198
199 ;; turn off electric-indent-mode
200 (when (fboundp 'electric-indent-mode) (electric-indent-mode -1))
201
202 ;; notmuch
203 (setq mail-user-agent 'message-user-agent)
204 (setq user-mail-address "ram@rkrishnan.org"
205       user-full-name "Ramakrishnan Muthukrishnan")
206
207 ;; smtp
208 (setq smtpmail-stream-type 'ssl
209       smtpmail-smtp-server "mail.messagingengine.com"
210       smtpmail-smtp-service 465)
211
212 ;; addressbook
213 (require 'notmuch-address)
214 (setq notmuch-address-command "/usr/bin/notmuch-addrlookup")
215 (notmuch-address-message-insinuate)
216
217 (require 'smtpmail)
218 (setq message-send-mail-function 'smtpmail-send-it)
219 (require 'starttls)
220
221 ;; sign all emails
222 (add-hook 'message-setup-hook 'mml-secure-message-sign-pgp)
223
224 (custom-set-faces
225  ;; custom-set-faces was added by Custom.
226  ;; If you edit it by hand, you could mess it up, so be careful.
227  ;; Your init file should contain only one such instance.
228  ;; If there is more than one, they won't work right.
229  )
230
231 ;; auto complete
232 (ac-config-default)
233