]> git.rkrishnan.org Git - .emacs.d.git/blob - init.el
acca2502164a419c7c50f7aa85e41d80b58ebb74
[.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  '(initial-frame-alist (quote ((fullscreen . maximized)))))
26 ;; Who use the bar to scroll?
27 (when (display-graphic-p)
28   (progn
29     (scroll-bar-mode 0)
30
31     (tool-bar-mode 0)
32     (menu-bar-mode 0)))
33
34 ; my-packages.el
35 (require 'package)
36 (add-to-list 'package-archives
37              '("melpa" . "http://melpa.milkbox.net/packages/") t)
38 (add-to-list 'package-archives
39              '("marmalade" . "http://marmalade-repo.org/packages/") t)
40 (package-initialize)
41
42 ; fetch the list of packages available
43 (unless package-archive-contents
44   (package-refresh-contents))
45
46 ;; make sure my list of packages are installed
47 (setq package-list '(go-mode
48                      rust-mode
49                      haskell-mode
50                      ghc
51                      restclient
52                      tangotango-theme
53                      fill-column-indicator
54                      paredit
55                      leuven-theme))
56
57 ; install the missing packages
58 (dolist (package package-list)
59   (unless (package-installed-p package)
60     (package-install package)))
61
62 ;; tangotango
63 (load-theme 'tangotango t)
64 ;; (load-theme 'leuven t)
65
66 ;; erc
67 (require 'erc)
68 (require 'tls)
69 ;; (setq tls-program '("openssl s_client -connect %h:%p -no_ssl2 -ign_eof"))
70
71 (erc-autojoin-mode t)
72 (setq erc-autojoin-channels-alist
73   '((".*\\.freenode.net" "#tahoe-lafs" "#plan9chan" "#inferno" "#cat-v" "#9front")
74     (".*\\.oftc.net" "#LeastAuthority")))
75
76 ;; check channels
77 (erc-track-mode t)
78 (setq erc-track-exclude-types '("JOIN" "NICK" "PART" "QUIT" "MODE"
79
80                                  "324" "329" "332" "333" "353" "477"))
81 ;; don't show any of this
82 (setq erc-hide-list '("JOIN" "PART" "QUIT" "NICK"))
83
84 (defun start-erc ()
85   "Connect to IRC."
86   (interactive)
87   (when (y-or-n-p "Do you want to start IRC? ")
88     (erc-tls :server "irc.freenode.net" :port 6697 :nick "rkrishnan" :full-name "Ramakrishnan Muthukrishnan")
89     (erc-tls :server "irc.oftc.net" :port 6697 :nick "rkrishnan" :full-name "Ramakrishnan Muthukrishnan")))
90
91 ;; switch to ERC with Ctrl+c e
92 (global-set-key (kbd "C-c e") 'start-erc) ;; ERC
93
94 ;; haskell mode
95 (setenv "PATH" (concat "~/.cabal/bin:" (getenv "PATH")))
96 (add-to-list 'exec-path "~/.cabal/bin")
97 (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
98 ;; (add-hook 'haskell-mode-hook 'haskell-indent-mode)
99 ;; (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
100 ;(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
101 (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
102
103 ;; haskell mode
104 (require 'haskell-interactive-mode)
105 (require 'haskell-process)
106 (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
107
108 (custom-set-variables
109   '(haskell-process-suggest-remove-import-lines t)
110   '(haskell-process-auto-import-loaded-modules t)
111   '(haskell-process-log t))
112
113 (eval-after-load "haskell-mode"
114   '(progn
115      (define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload)
116      (define-key haskell-mode-map (kbd "C-`") 'haskell-interactive-bring)
117      (define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
118      (define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
119      (define-key haskell-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
120      (define-key haskell-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)
121      (define-key haskell-mode-map (kbd "C-c c") 'haskell-process-cabal)
122      (define-key haskell-mode-map (kbd "SPC") 'haskell-mode-contextual-space)
123
124      (define-key haskell-cabal-mode-map (kbd "C-`") 'haskell-interactive-bring)
125      (define-key haskell-cabal-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)
126      (define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
127      (define-key haskell-cabal-mode-map (kbd "C-c c") 'haskell-process-cabal)))
128
129 ;; ghc-mod
130 (autoload 'ghc-init "ghc" nil t)
131 (autoload 'ghc-debug "ghc" nil t)
132 (setq ghc-debug t)
133 (add-hook 'haskell-mode-hook (lambda () (ghc-init)))
134 (custom-set-variables
135   '(haskell-process-type 'cabal-repl))
136
137 ;; ido
138 (setq ido-enable-flex-matching t)
139 (setq ido-everywhere t)
140 (ido-mode 1)
141
142 ;; disable tabs for indentation
143 (setq-default indent-tabs-mode nil)
144
145 ;; (require 'whitespace)
146 ;; (setq whitespace-style '(face lines-tail))
147 ;; (setq whitespace-line-column 80)
148 ;; (global-whitespace-mode t)
149
150 ;; ;; show trailing whitespaces
151 ;; (setq-default show-trailing-whitespace t)
152 ;; (setq-default indicate-empty-lines t)
153
154 ;; C style
155 (setq c-default-style "k&r"
156       c-basic-offset 4)
157
158 ;; hlint
159 (add-to-list 'load-path "~/.emacs.d/hs-lint")
160 (require 'hs-lint)
161 (defun my-haskell-mode-hook ()
162    (local-set-key "\C-cl" 'hs-lint))
163 (add-hook 'haskell-mode-hook 'my-haskell-mode-hook)
164
165 ;; gofmt
166 (add-hook 'before-save-hook #'gofmt-before-save)
167 (add-hook 'go-mode-hook (lambda ()
168                           (local-set-key (kbd "C-c C-r")
169                                          'go-remove-unused-imports)))
170 (add-hook 'go-mode-hook (lambda ()
171                           (local-set-key (kbd "C-c i")
172                                          'go-goto-imports)))
173
174 ;; asp
175 (add-to-list 'load-path "~/.emacs.d/asp-mode")
176 (autoload 'asp-mode "asp-mode")
177 (setq auto-mode-alist
178       (cons '("\\.asp\\'" . asp-mode) auto-mode-alist))
179
180 ;; line-number-mode
181 (global-linum-mode t)
182 (global-hl-line-mode 0)
183
184 ;; fci -- fill-column-indicator
185 (setq fci-rule-column 81)
186 (setq fci-rule-width 1)
187 (setq fci-rule-color "darkblue")
188
189 ;; turn off electric-indent-mode
190 (when (fboundp 'electric-indent-mode) (electric-indent-mode -1))