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