-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.el
51 lines (43 loc) · 1.64 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
;; Cryon's Emacs configuration
;; ---------------------------
(defvar config-dir (file-name-directory load-file-name))
(defvar hostname (downcase (car (split-string system-name "\\."))))
(defvar os (symbol-name system-type))
(defun cryon--config-path (file)
"Path to file in config directory"
(concat config-dir file))
(defun cryon--load-custom (file)
"Load file relative to the configuration folder"
(let ((path (cryon--config-path file)))
(when (file-exists-p path)
(load-file path))))
(defun cryon--load-directory (dir)
"Load all .el files in a directory relative to the configuration folder"
(mapc (lambda (f) (load-file (concat (file-name-as-directory dir) f)))
(directory-files dir nil "\\.el$")))
(defun cryon--fast-init (init-function)
"Apply the init function with less overhead"
(defvar cryon--file-name-handler-alist file-name-handler-alist)
(setq gc-cons-threshold 402653184
gc-cons-percentage 0.6
file-name-handler-alist nil)
(add-hook
'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold 16777216
gc-cons-percentage 0.1
file-name-handler-alist cryon--file-name-handler-alist)))
(funcall init-function))
(defun cryon--init ()
"The actual init function"
(cryon--load-custom "general.el")
(cryon--load-custom (concat "platform/" "os-" os ".el"))
(cryon--load-custom (concat "platform/" "host-" hostname ".el"))
(cryon--load-custom "packages.el")
(cryon--load-custom "keys.el")
(cryon--load-custom "customizations.el")
(cryon--load-directory (concat config-dir "auto"))
(server-start)
(cd "~")
(eshell))
(cryon--fast-init 'cryon--init)