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