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