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