-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.el
309 lines (266 loc) · 10.4 KB
/
init.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
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
;;; This file bootstraps the configuration, which is divided into
;;; a number of other files.
(let ((minver 23.3))
(when (version<= emacs-version "23.1")
(error "Your Emacs is too old -- this config requires v%s or higher" minver)))
(when (version<= emacs-version "24")
(message "Your Emacs is old, and some functionality in this config will be disabled. Please upgrade if possible."))
(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))
(require 'init-benchmarking) ;; Measure startup time
;; (setq emacs-load-start-time (current-time))
;;----------------------------------------------------------------------------
;; Which functionality to enable (use t or nil for true and false)
;;----------------------------------------------------------------------------
(defconst *spell-check-support-enabled* t) ;; Enable with t if you prefer
(defconst *is-a-mac* (eq system-type 'darwin))
(defconst *macbook-pro-support-enabled* t)
(defconst *is-carbon-emacs* (and *is-a-mac* (eq window-system 'mac)))
(defconst *is-cocoa-emacs* (and *is-a-mac* (eq window-system 'ns)))
(defconst *win32* (eq system-type 'windows-nt))
(defconst *cygwin* (eq system-type 'cygwin))
(defconst *linux* (or (eq system-type 'gnu/linux) (eq system-type 'linux)))
(defconst *unix* (or *linux* (eq system-type 'usg-unix-v) (eq system-type 'berkeley-unix)))
(defconst *linux-x* (and window-system *linux*))
(defconst *xemacs* (featurep 'xemacs) )
(defconst *emacs23* (and (not *xemacs*) (or (>= emacs-major-version 23))))
(defconst *emacs24* (and (not *xemacs*) (or (>= emacs-major-version 24))))
(defconst *no-memory* (cond
(*is-a-mac*
(< (string-to-number (nth 1 (split-string (shell-command-to-string "sysctl hw.physmem")))) 4000000000))
(*linux* nil)
(t nil)))
;;----------------------------------------------------------------------------
;; Bootstrap config
;;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
; Functions (load all files in defuns-dir)
; Copied from https://github.com/magnars/.emacs.d/blob/master/init.el
;----------------------------------------------------------------------------
(setq defuns-dir (expand-file-name "defuns" user-emacs-directory))
(dolist (file (directory-files defuns-dir t "\\w+"))
(when (file-regular-p file)
(load file)))
(require 'init-coding-system)
(require 'init-modeline)
;;;;;; (require 'cl-lib) ;; I already use emacs version 24.3, I don't need forward compatibility provided by `cl-lib'
;; (require 'init-compat) ;; idle require
(require 'init-utils)
(require 'init-site-lisp) ;; Must come before elpa, as it may provide package.el
;; win32 auto configuration, assuming that cygwin is installed at "c:/cygwin"
(condition-case nil
(when *win32*
(setq cygwin-mount-cygwin-bin-directory "c:/cygwin/bin")
(require 'setup-cygwin)
;; better to set HOME env in GUI
;; (setenv "HOME" "c:/cygwin/home/someuser")
)
(error
(message "setup-cygwin failed, continue anyway")))
(require 'idle-require)
(require 'init-elpa) ;; Machinery for installing required packages
(require 'init-exec-path) ;; Set up $PATH
;;----------------------------------------------------------------------------
;; Allow users to provide an optional "init-preload-local.el"
;;----------------------------------------------------------------------------
(require 'init-preload-local nil t)
;;----------------------------------------------------------------------------
;; Load configs for specific features and modes
;;----------------------------------------------------------------------------
(require-package 'wgrep)
(require-package 'project-local-variables)
(require-package 'diminish)
(require-package 'scratch)
(require-package 'mwe-log-commands)
(require 'init-frame-hooks)
;; any file use flyspell should be initialized after init-spelling.el
;; actually, I don't know which major-mode use flyspell.
(when *spell-check-support-enabled*
(require 'init-spelling))
;; (require 'init-xterm) ;; idle require
;; (require 'init-themes) ; color-themes 6.6.1 has some problem
;; (require 'init-osx-keys) ;; I'm not using mac OS X
(require 'init-gui-frames)
(require 'init-proxies)
(require 'init-maxframe)
(require 'init-dired)
(require 'init-isearch)
(require 'init-grep)
(require 'init-uniquify)
(require 'init-ibuffer)
(require 'init-flycheck)
;; (require 'init-flymake)
(require 'init-recentf)
(require 'init-ido)
(require 'init-hippie-expand)
;; (require 'init-auto-complete)
(require 'init-windows)
(require 'init-sessions)
(require 'init-fonts)
(require 'init-mmm)
(require 'init-editing-utils)
(require 'init-vc)
;; (require 'init-darcs)
(require 'init-git)
(require 'init-github)
(require 'init-smex)
(require 'init-helm)
;(require 'init-growl)
(require 'init-compile)
(require 'init-crontab)
;; (require 'init-textile) ;; idle require
(require 'init-markdown)
(require 'init-csv)
(require 'init-erlang)
;; (require 'init-javascript) ;; idle require
;; (require 'init-php)
(require 'init-org)
(require 'init-org-mime)
(require 'init-nxml)
;; (require 'init-html)
(require 'init-css)
(require 'init-haml)
(require 'init-python-mode)
;; (require 'init-haskell) ;; idle require
;; (require 'init-ruby-mode) ;; idle require
;; (require 'init-rails) ;; idle require
;; (require 'init-sql) ;; idle require
(require 'init-elisp)
;; (require 'init-marmalade)
;; (require 'init-org2blog) ;; idle require
(require 'init-yasnippet)
;; Use bookmark instead
(require 'init-zencoding-mode)
(require 'init-cc-mode)
(require 'init-gud)
(require 'init-cmake-mode)
;; (require 'init-csharp-mode) ;; idle require
(require 'init-linum-mode)
;(require 'init-delicious) ;make startup slow, I don't use delicious in w3m
(require 'init-emacs-w3m)
(require 'init-thing-edit)
(require 'init-which-func)
(require 'init-move-window-buffer)
;; (require 'init-gist)
(require 'init-moz)
(require 'init-gtags)
;; use evil mode (vi key binding)
(require 'init-evil)
(require 'init-sh)
(require 'init-ctags)
(require 'init-ace-jump-mode)
(require 'init-sunrise-commander)
(require 'init-bbdb)
;; (require 'init-gnus)
;; (require 'init-weibo) ;; idle require
;; (require 'init-lua-mode) ;; idle require
;;;;;; (require 'init-workgroups2)
(require 'init-term-mode)
(require 'init-web-mode)
(require 'init-sr-speedbar)
(require 'init-smartparens)
(require 'init-paredit)
(require 'init-lisp)
;; (require 'init-slime) ;; idle require
;; (require 'init-clojure)
;; (when (>= emacs-major-version 24)
;; (require 'init-clojure-cider))
(require 'init-common-lisp)
(when *emacs24*
(require 'init-company)
;; Choose either auto-complete or company-mode by commenting one of below two lines!
;; (require 'init-auto-complete) ; after init-yasnippeta to override TAB
)
(require 'init-stripe-buffer)
(require 'init-eim) ;; cannot be idle-required
(require 'init-tramp)
(require 'init-full-screen)
(require 'init-chinese-calendar)
(require 'init-eimp)
(require 'init-screenshot)
(require 'init-epa)
(require 'ace-jump-buffer)
(require 'init-asymptote)
(require 'init-vcard)
(require 'init-auctex)
(require 'init-cdlatex)
(require 'init-google-this)
(require 'init-ebib)
;; (require 'init-dash)
;; (require 'init-ledger)
;;;;;; (require 'init-ibus)
(require 'color-theme)
;; (require 'color-theme-molokai)
;; color theme
;; (if (daemonp) ;; if run from daemon
;; (add-hook 'after-make-frame-functions
;; (lambda (frame)
;; (select-frame frame)
;; (color-theme-molokai)))
;; (color-theme-molokai))
;; misc has some crucial tools I need immediately
(require 'init-misc)
(setq idle-require-idle-delay 3)
(setq idle-require-symbols '(init-compat
init-keyfreq
init-move-window-buffer
init-elnode
init-doxygen
init-pomodoro
init-emacspeak
init-artbollocks-mode
init-semantic
init-xterm
init-textile
init-javascript
init-haskell
init-ruby-mode
init-rails
init-sql
init-org2blog
init-csharp-mode
init-web-mode
init-lua-mode
init-slime))
(idle-require-mode 1) ;; starts loading
(require-package 'gnuplot)
(require-package 'lua-mode)
;; (require-package 'htmlize)
(require-package 'dsvn)
(when *is-a-mac*
(require-package 'osx-location))
(require-package 'regex-tool)
;;----------------------------------------------------------------------------
;; Allow access from emacsclient
;;----------------------------------------------------------------------------
;; (require 'server)
;; (unless (server-running-p)
;; (server-start))
;;----------------------------------------------------------------------------
;; Variables configured via the interactive 'customize' interface
;;----------------------------------------------------------------------------
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file))
;;----------------------------------------------------------------------------
;; Allow users to provide an optional "init-local" containing personal settings
;;----------------------------------------------------------------------------
(when (file-exists-p (expand-file-name "init-local.el" user-emacs-directory))
(error "Please move init-local.el to ~/.emacs.d/lisp"))
(require 'init-local nil t)
;;----------------------------------------------------------------------------
;; Locales (setting them earlier in this file doesn't work in X)
;;----------------------------------------------------------------------------
;; (require 'init-locales)
;; (add-hook 'after-init-hook
;; (lambda ()
;; (message "init completed in %.2fms"
;; (sanityinc/time-subtract-millis after-init-time before-init-time))))
;; (when (require 'time-date nil t)
;; (message "Emacs startup time: %d seconds."
;; (time-to-seconds (time-since emacs-load-start-time)))
;; )
;; Local Variables:
;; coding: utf-8
;; no-byte-compile: t
;; End:
(put 'erase-buffer 'disabled nil)