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