-
Notifications
You must be signed in to change notification settings - Fork 3
/
.emacs
177 lines (143 loc) · 5.74 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
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
;;------------------------------------------------------------------------------
;; debugging
(setq debug-on-error nil)
;; don't resize the frame on font changes etc
(setq frame-inhibit-implied-resize t)
;; this file's true directory
(setq dotfile-dir (file-name-directory
(file-chase-links
(or load-file-name
(buffer-file-name)))))
;; my stuff is in .emacs.d
(add-to-list 'load-path (concat dotfile-dir ".emacs.d/"))
;; 3rd party stuff is in site-lisp
(add-to-list 'load-path (concat dotfile-dir ".emacs.d/site-lisp/"))
;; packages
(setq package-user-dir (concat dotfile-dir ".emacs.d/packages/"))
;;------------------------------------------------------------------------------
;; apply custom variables
(setq custom-file (concat dotfile-dir ".emacs.d/custom.el"))
(load custom-file)
;;------------------------------------------------------------------------------
;; package setup
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("stable-melpa" . "http://stable.melpa.org/packages/")
("melpa" . "http://melpa.org/packages/")
("org-contrib" . "http://elpa.nongnu.org/nongnu/")
("cselpa" . "https://elpa.thecybershadow.net/packages/")))
(package-initialize)
(setq package-enable-at-startup nil)
(unless package-archive-contents
(message "Refreshing package archives...")
(package-refresh-contents))
(unless (package-installed-p 'use-package)
(message "`use-package' not found. Installing...")
(package-install 'use-package))
(setq use-package-enable-imenu-support t)
(require 'use-package)
(setq use-package-minimum-reported-time 0
use-package-verbose t
use-package-compute-statistics t)
(setq personal-keybindings nil)
;;------------------------------------------------------------------------------
;; Setup GC
(use-package gcmh
:ensure t
:config
(gcmh-mode 1))
;;------------------------------------------------------------------------------
;; Startup profiling
(use-package esup
:ensure t
:defer t)
;;------------------------------------------------------------------------------
;; Common settings
(load "common.el")
;;------------------------------------------------------------------------------
;; Graphic or terminal mode?
(if (display-graphic-p)
(load "graphic-display.el")
(load "terminal.el"))
;;------------------------------------------------------------------------------
;; Minor modes
(load "minor-modes.el")
;;------------------------------------------------------------------------------
;; Colors
(load "colors.el")
;;------------------------------------------------------------------------------
;; Global key bindings
(load "global-keys.el")
;;------------------------------------------------------------------------------
;; Major modes
(load "major-modes.el")
;;------------------------------------------------------------------------------
;; General programming
(load "prog.el")
;;------------------------------------------------------------------------------
;; C++
(load "cpp-modes.el")
;;------------------------------------------------------------------------------
;; Python
(load "python-modes.el")
;;------------------------------------------------------------------------------
;; Git
(load "git-config.el")
;;------------------------------------------------------------------------------
;; Org-mode stuff
(load "org-modes.el")
;;------------------------------------------------------------------------------
;; Byte-compile elisp on save
(defun byte-compile-current-buffer ()
"`byte-compile' current buffer if it's emacs-lisp-mode and compiled file exists."
(interactive)
(when (and (eq major-mode 'emacs-lisp-mode)
(file-exists-p (byte-compile-dest-file buffer-file-name)))
(byte-compile-file buffer-file-name)))
(add-hook 'after-save-hook 'byte-compile-current-buffer)
;;------------------------------------------------------------------------------
;; My stuff
(load "utilities.el")
(bind-key "C-x C-S-e" 'eval-and-replace)
(bind-key "C-c C-w" 'toggle-window-split)
(bind-key "C-c C-d" 'insert-current-date)
(bind-key "C-c C-t" 'insert-current-time)
(bind-key "C-c C-u" 'insert-uuid)
(bind-key "C-c C-f" 'my-search-forward-1)
(bind-key "C-c C-b" 'my-search-backward-1)
;;------------------------------------------------------------------------------
;; Graphic window settings
(when (display-graphic-p)
(setq default-frame-height (frame-height))
(setq default-frame-alist
(append
`((width . ,column-wrap-hard)
(height . ,default-frame-height))
default-frame-alist))
(size-frame-default))
;;------------------------------------------------------------------------------
;; Start server
(require 'server)
(unless (server-running-p)
(server-start))
(put 'narrow-to-region 'disabled nil)
;;------------------------------------------------------------------------------
;; Hacks & late-bound overrides
(load "hacks.el")
;------------------------------------------------------------------------------
;; apply local site-specific changes
(let ((local-file (concat dotfile-dir ".emacs.d/local.el")))
(load local-file))
;------------------------------------------------------------------------------
;; welcome dashboard
(when (display-graphic-p)
(use-package welcome-dashboard
:ensure nil ;; when using local file and not straight nor use-package
:config
(setq welcome-dashboard-latitude 39.9237
welcome-dashboard-longitude -104.9201
welcome-dashboard-image-file (concat dotfile-dir ".emacs.d/site-lisp/lorikeet.png")
welcome-dashboard-title (concat "Welcome " user-full-name ", have a great day!"))
(welcome-dashboard-create-welcome-hook)))
;; Local Variables:
;; byte-compile-warnings: (not free-vars)
;; End: