/
init.el
102 lines (82 loc) · 3.12 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
;;; init.el -- Entry point
;; Configuration root directory path.
(setq config-dir (file-name-directory
(or (buffer-file-name) load-file-name)))
(add-to-list 'load-path config-dir)
(progn (cd (concat config-dir "/themes"))
(normal-top-level-add-subdirs-to-load-path))
(progn (cd (concat config-dir "/lib"))
(normal-top-level-add-subdirs-to-load-path))
(progn (cd config-dir)
(normal-top-level-add-subdirs-to-load-path))
;; Load initial configuration.
(when window-system
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
(tooltip-mode -1)
(mouse-wheel-mode t)
(tool-bar-mode -1)
(when (not (equal system-type 'darwin))
(menu-bar-mode -1))
(blink-cursor-mode -1))
(require 'config-colors)
(require 'config-defuns)
(require 'config-completion)
(require 'config-preferences)
(require 'config-erc)
(require 'config-bindings)
(require 'config-less-mode)
(require 'config-python-mode)
(require 'config-clojure-mode)
(require 'go-mode-load)
(require 'config-go-mode)
(require 'config-coffeescript)
(require 'config-haskell-mode)
;; ***************************************************************************
;; Custom hooks for the window frame
;; ---------------------------------
;; Two new separate hooks for the creation of
;; 1. window-system
;; 2. tty (console) frames.
;;
;; This is used to run different code for console and window-system.
;; See colors.el for example.
;;
(defvar after-make-console-frame-hooks '()
"Hooks to run after creating a new TTY frame")
(defvar after-make-window-system-frame-hooks '()
"Hooks to run after creating a new window-system frame")
(defun run-after-make-frame-hooks (frame)
"Selectively run either `after-make-console-frame-hooks' or
`after-make-window-system-frame-hooks'"
(select-frame frame)
(run-hooks (if window-system
'after-make-window-system-frame-hooks
'after-make-console-frame-hooks)))
(add-hook 'after-make-frame-functions
'run-after-make-frame-hooks)
(add-hook 'after-init-hook
(lambda ()
(run-after-make-frame-hooks (selected-frame))))
;; ***************************************************************************
;; Automatically recompile the emacs init file on buffer-save or exit
;; ------------------------------------------------------------------
;;
(defun byte-compile-user-init-file ()
(let ((byte-compile-warnings '(unresolved)))
;; in case compilation fails, don't leave the old .elc around:
(when (file-exists-p (concat user-init-file ".elc"))
(delete-file (concat user-init-file ".elc")))
(byte-compile-file user-init-file)
;; (message "%s compiled" user-init-file)
))
(defun my-emacs-lisp-mode-hook ()
(when (equal buffer-file-name user-init-file)
(add-hook 'after-save-hook 'byte-compile-user-init-file t t)))
;; (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
(add-hook 'emacs-lisp-mode-hook 'my-emacs-lisp-mode-hook)
(add-hook 'kill-emacs-hook 'byte-compile-user-init-file t t)
;; ***************************************************************************
;; Default directory.
;;
(setq default-directory "~/")
;;; init.el ends here