-
Notifications
You must be signed in to change notification settings - Fork 13
/
.emacs
142 lines (109 loc) · 4.62 KB
/
.emacs
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
;; A lighter-weight init.el for 24
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)
(when (null package-archive-contents)
(package-refresh-contents))
(defvar my-packages '(better-defaults
idle-highlight-mode
elisp-slime-nav paredit
smex scpaste parenface-plus
find-file-in-project magit
clojure-mode))
(dolist (p my-packages)
(when (not (package-installed-p p))
(package-install p)))
(setq-default ispell-program-name "aspell")
(set-face-foreground 'vertical-border "white")
(when (<= (display-color-cells) 8)
(defun hl-line-mode () (interactive)))
;; erc? why not
(setq erc-prompt ">"
erc-fill-column 75
erc-header-line-format nil
erc-hide-list '("JOIN" "PART" "QUIT" "NICK")
erc-track-exclude-types '("324" "329" "332" "333" "353" "477" "MODE"
"JOIN" "PART" "QUIT" "NICK")
erc-lurker-threshold-time 3600
erc-track-priority-faces-only t
erc-join-buffer 'bury
erc-autojoin-timing :ident
erc-flood-protect nil
erc-server-send-ping-interval 45
erc-server-send-ping-timeout 180
erc-server-reconnect-timeout 60
erc-autojoin-channels-alist
'(("freenode.net" "#emacs" "#clojure" "#leiningen" "#seajure"))
erc-prompt-for-nickserv-password nil)
(eval-after-load 'erc
'(progn
(when (not (package-installed-p 'erc-hl-nicks))
(package-install 'erc-hl-nicks))
(require 'erc-spelling)
(require 'erc-services)
(require 'erc-truncate)
(require 'erc-hl-nicks)
(require 'notifications)
(erc-services-mode 1)
(erc-truncate-mode 1)
(setq erc-complete-functions '(erc-pcomplete erc-button-next))
(setq-default erc-ignore-list '("Lajla"))
(add-to-list 'erc-modules 'hl-nicks)
(add-to-list 'erc-modules 'spelling)
(set-face-foreground 'erc-input-face "dim gray")
(set-face-foreground 'erc-my-nick-face "blue")))
;;; bindings
(global-set-key (kbd "C-c C-j") 'nrepl-jack-in)
(global-set-key (kbd "C-c f") 'find-file-in-project)
(add-hook 'prog-mode-hook
(defun my-kill-word-key ()
(local-set-key (kbd "C-M-h") 'backward-kill-word)))
(global-set-key (kbd "C-M-h") 'backward-kill-word)
(global-set-key (kbd "C-x C-i") 'imenu)
(global-set-key (kbd "C-x M-f") 'ido-find-file-other-window)
(global-set-key (kbd "C-c y") 'bury-buffer)
(global-set-key (kbd "C-c r") 'revert-buffer)
(global-set-key (kbd "C-x O") (lambda () (interactive) (other-window -1)))
(global-set-key (kbd "C-x C-o") (lambda () (interactive) (other-window 2)))
(global-set-key (kbd "C-x m") 'eshell)
(global-set-key (kbd "C-x C-m") 'shell)
(global-set-key (kbd "C-c q") 'join-line)
(global-set-key (kbd "C-c g") 'magit-status)
(global-set-key (kbd "C-c n")
(defun pnh-cleanup-buffer () (interactive)
(delete-trailing-whitespace)
(untabify (point-min) (point-max))
(indent-region (point-min) (point-max))))
(global-set-key (kbd "C-c b")
(defun pnh-blog () (interactive)
(shell-command (format "rake post POST=%s"
(car (split-string (buffer-name)
"\\."))))))
(eval-after-load 'paredit
;; need a binding that works in the terminal
'(progn
(define-key paredit-mode-map (kbd "M-)") 'paredit-forward-slurp-sexp)
(define-key paredit-mode-map (kbd "M-(") 'paredit-backward-slurp-sexp)))
;;; eshell
(defun eshell/rgrep (&rest args)
"Use Emacs grep facility instead of calling external grep."
(eshell-grep "rgrep" args t))
(defun eshell/cdg ()
"Change directory to the project's root."
(eshell/cd (locate-dominating-file default-directory ".git")))
;;; programming
(add-hook 'prog-mode-hook 'whitespace-mode)
(add-hook 'prog-mode-hook 'idle-highlight-mode)
(add-hook 'prog-mode-hook 'hl-line-mode)
(add-hook 'clojure-mode-hook 'paredit-mode)
(add-hook 'nrepl-connected-hook
(defun pnh-clojure-mode-eldoc-hook ()
(add-hook 'clojure-mode-hook 'turn-on-eldoc-mode)))
(setq whitespace-style '(face trailing lines-tail tabs))
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
(add-hook 'emacs-lisp-mode-hook 'elisp-slime-nav-mode)
(add-hook 'emacs-lisp-mode-hook 'paredit-mode)
(define-key emacs-lisp-mode-map (kbd "C-c v") 'eval-buffer)
(define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol)
(define-key lisp-mode-shared-map (kbd "RET") 'reindent-then-newline-and-indent)