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