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