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