forked from technomancy/emacs-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 17
/
starter-kit-misc.el
177 lines (142 loc) · 5.84 KB
/
starter-kit-misc.el
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
;;; starter-kit-misc.el --- Things that don't fit anywhere else
;;
;; Part of the Emacs Starter Kit
(when window-system
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
(tooltip-mode -1)
(mouse-wheel-mode t)
(blink-cursor-mode -1))
(add-hook 'before-make-frame-hook 'turn-off-tool-bar)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(ansi-color-for-comint-mode-on)
(setq visible-bell t
fringe-mode (cons 4 0)
echo-keystrokes 0.1
font-lock-maximum-decoration t
inhibit-startup-message t
transient-mark-mode t
color-theme-is-global t
shift-select-mode nil
mouse-yank-at-point t
require-final-newline t
truncate-partial-width-windows nil
uniquify-buffer-name-style 'forward
ffap-machine-p-known 'reject
whitespace-style '(trailing lines space-before-tab
face indentation space-after-tab)
whitespace-line-column 100
ediff-window-setup-function 'ediff-setup-windows-plain
oddmuse-directory (concat dotfiles-dir "oddmuse")
xterm-mouse-mode t
save-place-file (concat dotfiles-dir "places"))
(add-to-list 'safe-local-variable-values '(lexical-binding . t))
(add-to-list 'safe-local-variable-values '(whitespace-line-column . 80))
;; Set this to whatever browser you use
;; (setq browse-url-browser-function 'browse-url-firefox)
;; (setq browse-url-browser-function 'browse-default-macosx-browser)
;; (setq browse-url-browser-function 'browse-default-windows-browser)
;; (setq browse-url-browser-function 'browse-default-kde)
;; (setq browse-url-browser-function 'browse-default-epiphany)
;; (setq browse-url-browser-function 'browse-default-w3m)
;; (setq browse-url-browser-function 'browse-url-generic
;; browse-url-generic-program "~/src/conkeror/conkeror")
;; Transparently open compressed files
(auto-compression-mode t)
;; Enable syntax highlighting for older Emacsen that have it off
(global-font-lock-mode t)
;; Save a list of recent files visited.
(recentf-mode 1)
;; Highlight matching parentheses when the point is on them.
(show-paren-mode 1)
;; Matching parentheses for all languages and so on
(autopair-global-mode t)
(setq autopair-autowrap t)
;; Fix for triple quotes in python
(add-hook 'python-mode-hook
#'(lambda ()
(setq autopair-handle-action-fns
(list #'autopair-default-handle-action
#'autopair-python-triple-quote-action))))
;; ido-mode is like magic pixie dust!
(when (> emacs-major-version 21)
(ido-mode t)
(setq ido-enable-prefix nil
ido-enable-flex-matching t
ido-create-new-buffer 'always
ido-use-filename-at-point 'guess
ido-max-prospects 10))
(set-default 'indent-tabs-mode nil)
(set-default 'indicate-empty-lines t)
(set-default 'imenu-auto-rescan t)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(add-hook 'text-mode-hook 'turn-on-flyspell)
(defvar coding-hook nil
"Hook that gets run on activation of any programming mode.")
(defalias 'yes-or-no-p 'y-or-n-p)
(random t) ;; Seed the random-number generator
(defalias 'auto-revert-tail-mode 'tail-mode)
;; Hippie expand: at times perhaps too hip
(delete 'try-expand-line hippie-expand-try-functions-list)
(delete 'try-expand-list hippie-expand-try-functions-list)
(delete 'try-complete-file-name-partially hippie-expand-try-functions-list)
(delete 'try-complete-file-name hippie-expand-try-functions-list)
;; Don't clutter up directories with files~
(setq backup-directory-alist `(("." . ,(expand-file-name
(concat dotfiles-dir "backups")))))
;; nxhtml stuff
(setq mumamo-chunk-coloring 'submode-colored
nxhtml-skip-welcome t
indent-region-mode t
rng-nxml-auto-validate-flag nil)
;; Associate modes with file extensions
(add-to-list 'auto-mode-alist '("COMMIT_EDITMSG$" . diff-mode))
(add-to-list 'auto-mode-alist '("\\.css$" . css-mode))
(add-to-list 'auto-mode-alist '("\\.ya?ml$" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.xml$" . nxml-mode))
(eval-after-load 'grep
'(when (boundp 'grep-find-ignored-files)
(add-to-list 'grep-find-ignored-files "target")
(add-to-list 'grep-find-ignored-files "*.class")))
;; Default to unified diffs
(setq diff-switches "-u -w"
magit-diff-options "-w")
;; Cosmetics
(set-face-background 'vertical-border "white")
(set-face-foreground 'vertical-border "white")
(eval-after-load 'diff-mode
'(progn
(set-face-foreground 'diff-added "green4")
(set-face-foreground 'diff-removed "red3")))
(eval-after-load 'magit
'(progn
(set-face-foreground 'magit-diff-add "green3")
(set-face-foreground 'magit-diff-del "red3")
(when (not window-system)
(set-face-background 'magit-item-highlight "white"))))
(eval-after-load 'mumamo
'(eval-after-load 'zenburn
'(ignore-errors (set-face-background
'mumamo-background-chunk-submode "gray22"))))
;; Platform-specific stuff
(when (eq system-type 'darwin)
;; Work around a bug on OS X where system-name is FQDN
(setq system-name (car (split-string system-name "\\."))))
;; make emacs use the clipboard
(setq x-select-enable-clipboard t)
;; Get around the emacswiki spam protection
(add-hook 'oddmuse-mode-hook
(lambda ()
(unless (string-match "question" oddmuse-post)
(setq oddmuse-post (concat "uihnscuskc=1;" oddmuse-post)))))
;; Yasnippet setup
(yas/initialize)
(yas/load-directory (concat dotfiles-dir "elpa-to-submit/yasnippet/snippets"))
(setq yas/prompt-functions '(yas/dropdown-prompt yas/ido-prompt yas/x-prompt))
(setq yas/wrap-around-region 'cua)
(provide 'starter-kit-misc)
;;; starter-kit-misc.el ends here