]> git.rkrishnan.org Git - .emacs.d.git/blob - init.el
use https for the package repository urls
[.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") ;;  "#plan9chan" "#cat-v")
54     (".*\\.oftc.net" "#LeastAuthority" "#debian-in")))
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-process)
81 (require 'haskell-interactive-mode)
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
221 ;; which function?
222 (which-func-mode 1)
223 (add-to-list 'which-func-modes '(c-mode c++-mode rust-mode haskell-mode))