summaryrefslogtreecommitdiffstats
path: root/.emacs.d/init.el
blob: cd9c9b5d7c6be4c88958d2617446b6558729f610 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
;;; init.el --- ryuslash's emacs init

;;; Commentary:
;; Does so much and changes so often


;;; Code:

(load (concat user-emacs-directory "init2"))

(define-key key-translation-map (kbd "C-j") (kbd "C-l"))
(define-key key-translation-map (kbd "C-l") (kbd "C-j"))

(defalias 'yes-or-no-p 'y-or-n-p)
(defalias 'list-buffers 'ibuffer)
(defalias 'dabbrev-expand 'hippie-expand)

(defface git-commit-summary-face
  '((t (:inherit org-level-1)))
  "Face for the git title line."
  :group 'local)

(defface git-commit-overlong-summary-face
  '((t (:background "#873732")))
  "Face for commit titles that are too long."
  :group 'local)

(defface git-commit-nonempty-second-line-face
  '((t (:inherit git-commit-overlong-summary-face)))
  "Face for the supposedly empty line in commit messages."
  :group 'local)

(eval-after-load "eldoc"
  '(diminish 'eldoc-mode))

(eval-after-load "em-term"
  '(add-to-list 'eshell-visual-commands "unison"))

(eval-after-load "emms-source-file"
  '(progn
     (require 'emms-setup)
     (require 'emms-player-mpd)

     (emms-standard)

     (add-to-list 'emms-info-functions 'emms-info-mpd)
     (add-to-list 'emms-player-list 'emms-player-mpd)

     (setq emms-player-mpd-server-name "localhost")
     (setq emms-player-mpd-server-port "6600")
     (setq emms-player-mpd-music-directory "/mnt/music/mp3")))

(eval-after-load "flymake"
  '(progn
     (require 'flymake-cursor)

     (add-to-list                       ; Make sure pyflakes is loaded
      'flymake-allowed-file-name-masks  ; for python files.
      '("\\.py\\'" ext:flymake-pyflakes-init))

     (add-to-list                       ; Error line repexp for go
      'flymake-err-line-patterns        ; compilation.
      '("^\\([a-zA-Z0-9_]+\\.go\\):\\([0-9]+\\):\\(.*\\)$"
        1 2 nil 3))

     (add-to-list                       ; Go uses makefiles, makes
      'flymake-allowed-file-name-masks  ; flymaking 'easy'.
      '("\\.go$" flymake-simple-make-init))))

(eval-after-load "ido"
  '(setq ido-ignore-buffers `(,@ido-ignore-buffers
                              "^\\*.*\\*$" "^irc\\." "^\\#")))

(eval-after-load "jabber"
  '(remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo))

(eval-after-load "newst-treeview"
  '(require 'newsticker-init))

(eval-after-load "org"
  '(require 'org-init))

(eval-after-load "pretty-symbols-mode"
  '(diminish 'pretty-symbols-mode))

(eval-after-load "rainbow-mode"
  '(diminish 'rainbmow-mode))

(eval-after-load "smex"
  '(progn
     (global-set-key (kbd "M-x") 'smex)
     (global-set-key (kbd "C-M-x") 'smex-major-mode-commands)))

(eval-after-load "yasnippet"
  '(diminish 'yas-minor-mode))

(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(put 'narrow-to-region 'disabled nil)
(put 'scroll-left 'disabled nil)

(setq-default bidi-paragraph-direction 'left-to-right)
(setq-default c-basic-offset 4)
(setq-default fci-rule-column 73)
(setq-default gac-automatically-push-p t)
(setq-default indent-tabs-mode nil)
(setq-default php-mode-warn-if-mumamo-off nil)
(setq-default require-final-newline t)
(setq-default tab-width 4)
(setq-default truncate-lines t)

(setq appt-disp-window-function #'oni:appt-display-window-and-jabber)
(setq appt-display-diary nil)
(setq auto-mode-case-fold nil)
(setq auto-save-file-name-transforms
      `((".*" ,temporary-file-directory t)))
(setq avandu-article-render-function #'avandu-view-w3m)
(setq backup-directory-alist
      `((".*" . ,temporary-file-directory)))
(setq browse-url-browser-function 'browse-url-generic)
(setq browse-url-generic-program (getenv "BROWSER"))
(setq c-offsets-alist '((statement-block-intro . +)
   (knr-argdecl-intro . 5)
   (substatement-open . +)
   (substatement-label . 0)
   (label . 0)
   (statement-case-open . +)
   (statement-cont . +)
   (arglist-intro . +)
   (arglist-close . 0)
   (inline-open . 0)
   (brace-list-open . +)
   (topmost-intro-cont first c-lineup-topmost-intro-cont
                       c-lineup-gnu-DEFUN-intro-cont)))
(setq comment-auto-fill-only-comments t)
(setq custom-file "~/.emacs.d/custom.el")
(setq custom-theme-directory "~/.emacs.d/themes")
(setq default-frame-alist
      `((border-width . 0)
        (internal-border-width . 0)
        (vertical-scroll-bars . nil)
        (menu-bar-lines . nil)
        (tool-bar-lines . nil)
        (font . "monaco-12")))
(setq emms-source-file-default-directory "/mnt/music/")
(setq erc-autojoin-channels-alist
      '(("freenode.net" "#ninthfloor" "#emacs" "#dispass")))
(setq erc-hide-list '("JOIN" "PART" "QUIT"))
(setq erc-insert-timestamp-function 'erc-insert-timestamp-left)
(setq erc-nick "ryuslash")
(setq erc-timestamp-format "[%H:%M] ")
(setq erc-timestamp-only-if-changed-flag nil)
(setq eshell-highlight-prompt nil)
(setq eshell-prompt-function 'oni:eshell-prompt-function)
(setq eshell-prompt-regexp "^[#$]> ")
(setq fci-rule-color "darkred")
(setq flymake-gui-warnings-enabled nil)
(setq flymake-info-line-regexp
      (eval-when-compile
        (regexp-opt
         '("Invalid name"
           "String statement has no effect"
           "Missing docstring"
           "Empty docstring"
           "multiple imports on one line"
           "expected 2 blank lines, found 1"
           "expected 2 blank lines, found 0"
           "TODO:"
           "whitespace after '{'"
           "whitespace before '}'"
           "whitespace before ':'"
           "whitespace after '('"
           "whitespace before ')'"
           "whitespace after '['"
           "whitespace before ']'"
           "the backslash is redundant between brackets"
           "continuation line over-indented for visual indent"
           "continuation line under-indented for visual indent"
           "Too many statements"
           "comparison to None should be"
           "missing whitespace around operator"
           "missing whitespace after ','"
           "line too long"
           "at least two spaces before inline comment"
           "trailing whitespace"
           "imported but unused"
           "Unused import"
           "too many blank lines"))))
(setq flymake-log-file-name (expand-file-name "~/.emacs.d/flymake.log"))
(setq flymake-log-level 0)
(setq flymake-warn-line-regexp
      (eval-when-compile
        (regexp-opt '("warning"
                      "Warning"
                      "redefinition of unused"
                      "Redefining built-in"
                      "Redefining name"
                      "Unused argument"
                      "Unused variable"
                      "Dangerous default value {} as argument"
                      "no newline at end of file"
                      "Access to a protected member"))))
(setq frame-title-format '(:eval (concat "emacs: " (buffer-name))))
(setq geiser-repl-history-filename "~/.emacs.d/geiser-history")
(setq gnus-init-file "~/.emacs.d/gnus")
(setq gtags-auto-update t)
(setq help-at-pt-display-when-idle t)
(setq ido-auto-merge-delay-time 1000000)
(setq ido-default-buffer-method 'selected-window)
(setq ido-max-window-height 1)
(setq ido-save-directory-list-file nil)
(setq ido-ubiquitous-command-exceptions '(org-refile))
(setq inferior-lisp-program "sbcl")
(setq inhibit-default-init t)
(setq inhibit-local-menu-bar-menus t)
(setq inhibit-startup-message t)
(setq initial-major-mode 'emacs-lisp-mode)
(setq initial-scratch-message nil)
(setq jabber-account-list '(("ryuslash@jabber.org")
                            ("tom@ryuslash.org"
                             (:connection-type . ssl))))
(setq jabber-chat-buffer-format "*jabber:%n*")
(setq jabber-chat-buffer-show-avatar nil)
(setq jabber-chat-fill-long-lines nil)
(setq jabber-chat-foreign-prompt-format "%t <\n")
(setq jabber-chat-local-prompt-format "%t >\n")
(setq jabber-chatstates-confirm nil)
(setq jabber-history-dir "~/.emacs.d/jabber")
(setq jabber-roster-show-bindings nil)
(setq jit-lock-defer-time 0.2)
(setq magit-repo-dirs '("~/projects/" "~/var/src/"))
(setq message-log-max 1000)
(setq message-send-mail-function 'message-send-mail-with-sendmail)
(setq message-sendmail-extra-arguments '("-a" "ryuslash"))
(setq package-archives
      '(("melpa" . "http://melpa.milkbox.net/packages/")
        ("ELPA" . "http://tromey.com/elpa/")
        ("gnu" . "http://elpa.gnu.org/packages/")
        ("marmalade" . "http://marmalade-repo.org/packages/")))
(setq package-load-list '((htmlize "1.39")
                          (lua-mode "20111107")
                          all))
(setq php-function-call-face 'font-lock-function-name-face)
(setq php-mode-force-pear t)
(setq pony-tpl-indent-moves t)
(setq pp^L-^L-string-function 'oni:pretty-control-l-function)
(setq pp^L-^L-string-pre nil)
(setq rainbow-delimiters-max-face-count 12)
(setq redisplay-dont-pause t)
(setq send-mail-function 'smtpmail-send-it)
(setq sendmail-program "/usr/bin/msmtp")
(setq smex-key-advice-ignore-menu-bar t)
(setq smex-save-file "~/.emacs.d/smex-items")
(setq split-height-threshold 40)
(setq time-stamp-active t)
(setq time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S (%u)")
(setq type-break-good-rest-interval (* 60 10))
(setq type-break-interval (* 60 50))
(setq type-break-keystroke-threshold '(nil . nil))
(setq uniquify-buffer-name-style 'post-forward)
(setq use-dialog-box nil)
(setq user-full-name "Tom Willemsen")
(setq user-mail-address "tom@ryuslash.org")
(setq w3m-fill-column 72)
(setq window-combination-resize t)
(setq yas-fallback-behavior nil)
(setq yas-prompt-functions '(yas-ido-prompt))

(add-hook 'after-change-major-mode-hook 'set-current-mode-icon)
(add-hook 'after-save-hook 'oni:after-save-func t)
(add-hook 'before-save-hook 'oni:before-save-func)
(add-hook 'c-mode-hook 'oni:c-mode-func)
(add-hook 'css-mode-hook 'oni:css-mode-func)
(add-hook 'diary-display-hook 'oni:diary-display-func)
(add-hook 'emacs-lisp-mode-hook 'oni:emacs-lisp-mode-func)
(add-hook 'erc-mode-hook 'oni:erc-mode-func)
(add-hook 'eshell-mode-hook 'oni:eshell-mode-func)
(add-hook 'flymake-mode-hook 'oni:flymake-mode-func)
(add-hook 'go-mode-hook 'oni:go-mode-func)
(add-hook 'gtags-mode-hook 'oni:gtags-mode-func)
(add-hook 'html-mode-hook 'oni:html-mode-func)
(add-hook 'jabber-alert-message-hooks 'oni:jabber-alert-message-func)
(add-hook 'jabber-chat-mode-hook 'oni:jabber-chat-mode-func)
(add-hook 'jabber-roster-mode-hook 'oni:jabber-roster-mode-func)
(add-hook 'java-mode-hook 'oni:java-mode-func)
(add-hook 'js-mode-hook 'oni:js-mode-func)
(add-hook 'js2-mode-hook 'oni:js2-mode-func)
(add-hook 'lua-mode-hook 'oni:lua-mode-func)
(add-hook 'magit-log-edit-mode-hook 'oni:magit-log-edit-mode-func)
(add-hook 'markdown-mode-hook 'oni:markdown-mode-func)
(add-hook 'message-mode-hook 'oni:message-mode-func)
(add-hook 'org-mode-hook 'oni:org-mode-func)
(add-hook 'php-mode-hook 'oni:php-mode-func)
(add-hook 'prog-mode-hook 'oni:prog-mode-func)
(add-hook 'python-mode-hook 'oni:python-mode-func)
(add-hook 'rst-mode-hook 'oni:rst-mode-func)
(add-hook 'term-mode-hook 'oni:term-mode-func)
(add-hook 'texinfo-mode-hook 'oni:texinfo-mode-func)
(add-hook 'write-file-hooks 'oni:write-file-func)
(add-hook 'yas-minor-mode-hook 'oni:yas-minor-mode-func)

(global-set-key (kbd "'") 'oni:self-insert-dwim)
(global-set-key (kbd "<XF86AudioNext>") 'emms-next)
(global-set-key (kbd "<XF86AudioPlay>") 'oni:emms-toggle-playing)
(global-set-key (kbd "<XF86AudioPrev>") 'emms-previous)
(global-set-key (kbd "<XF86AudioStop>") 'emms-stop)
(global-set-key (kbd "<XF86HomePage>") 'oni:raise-scratch)
(global-set-key (kbd "<XF86Mail>") 'oni:view-mail)
(global-set-key (kbd "<XF86Tools>") 'oni:start-emms)
(global-set-key (kbd "<f10>") 'git-project-show-files)
(global-set-key (kbd "<f5>") 'ext:reload-buffer)
(global-set-key (kbd "<f6>") 'jabber-switch-to-roster-buffer)
(global-set-key (kbd "<f7>") 'magit-status)
(global-set-key (kbd "<f8>") 'oni:raise-eshell)
(global-set-key (kbd "C-<") 'oni:indent-shift-left)
(global-set-key (kbd "C->") 'oni:indent-shift-right)
(global-set-key (kbd "C-M-4") 'split-window-vertically)
(global-set-key (kbd "C-M-SPC") 'er/expand-region)
(global-set-key (kbd "C-M-d") 'kill-word)
(global-set-key (kbd "C-M-w") 'backward-kill-word)
(global-set-key (kbd "C-S-k") 'kill-whole-line)
(global-set-key (kbd "C-a") 'oni:move-beginning-of-dwim)
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)
(global-set-key (kbd "C-c i p") 'identica-update-status-interactive)
(global-set-key (kbd "C-c p") 'oni:show-buffer-position)
(global-set-key (kbd "C-c t") 'oni:raise-ansi-term)
(global-set-key (kbd "C-d") 'oni:kill-region-or-forward-char)
(global-set-key (kbd "C-e") 'oni:move-end-of-dwim)
(global-set-key (kbd "C-k") 'oni:kill-region-or-line)
(global-set-key (kbd "C-w") 'oni:kill-region-or-backward-char)
(global-set-key (kbd "M-4") 'split-window-horizontally)
(global-set-key (kbd "M-n") 'idomenu)
(global-set-key (kbd "\"") 'oni:self-insert-dwim)
(global-set-key (kbd "M-o") 'other-window)
(global-set-key (kbd "M-1") 'delete-other-windows)
(global-set-key (kbd "M-2") 'split-window-below)
(global-set-key (kbd "M-3") 'split-window-right)
(global-set-key (kbd "M-0") 'delete-window)

(if (daemonp)
    (global-set-key "\C-x\C-c" 'oni:close-client-window))

(when (or window-system (daemonp))
  (global-unset-key "\C-z"))

(add-to-list 'auto-mode-alist '("\\.jl$" . sawfish-mode))
(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js2-mode))
(add-to-list 'auto-mode-alist
             '("\\.m\\(ark\\)?d\\(?:o?wn\\)?$" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.php[345]?$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.po\\'\\|\\.po\\." . po-mode))
(add-to-list 'auto-mode-alist '("\\.tpl$" . html-mode))
(add-to-list 'auto-mode-alist '("^PKGBUILD$" . shell-script-mode))
(add-to-list 'auto-mode-alist '("^\\.Xmodmap$" . xmodmap-mode))

(add-to-list 'debug-ignored-errors "^Can't shift all lines enough")

(add-to-list
 'display-buffer-alist
 '("^\\*\\(?:.+-\\)?scratch\\*$" . ((display-buffer-same-window . nil))))
(add-to-list
 'display-buffer-alist
 '("^\\*git-project-list\\*$" . ((git-project-show-window . nil))))
(add-to-list
 'display-buffer-alist
 '("^\\*magit: .*\\*$" . ((display-buffer-same-window . nil))))

(unless (oni:required-packages-installed-p)
  (message "%s" "Refreshing package database...")
  (package-refresh-contents)
  (message "%s" " done.")
  (mapc #'(lambda (package)
            (when (not (package-installed-p package))
              (package-install package)))
        oni:required-packages))

(blink-cursor-mode -1)
(column-number-mode -1)
(line-number-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)

(auto-insert-mode)
(electric-indent-mode)
(electric-pair-mode)
(ido-mode)
(ido-ubiquitous-mode)
(savehist-mode)
(show-paren-mode)
(winner-mode)

(smex-initialize)
(help-at-pt-set-timer)

(load-theme 'yoshi t)

(load custom-file)
;; (load "rudel-loaddefs.el")
(load (expand-file-name "~/quicklisp/slime-helper.el"))

(load "quick-edit-mode")
(global-set-key (kbd "C-z") 'quick-edit-mode)

(unless (server-running-p)
  (server-start))

(diminish 'auto-fill-function "_")
(ac-config-default)

(provide 'init)

;;; init.el ends here