-
Notifications
You must be signed in to change notification settings - Fork 243
/
init.el
232 lines (205 loc) · 8.51 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
;; Emacs LIVE
;;
;; This is where everything starts. Do you remember this place?
;; It remembers you...
(setq live-ascii-art-logo ";;
;; MM\"\"\"\"\"\"\"\"`M
;; MM mmmmmmmM
;; M` MMMM 88d8b.d8b. .d8888b. .d8888b. .d8888b.
;; MM MMMMMMMM 88''88'`88 88' `88 88' `\"\" Y8ooooo.
;; MM MMMMMMMM 88 88 88 88. .88 88. ... 88
;; MM .M dP dP dP `88888P8 '88888P' '88888P'
;; MMMMMMMMMMMM
;;
;; M\"\"MMMMMMMM M\"\"M M\"\"MMMMM\"\"M MM\"\"\"\"\"\"\"\"`M
;; M MMMMMMMM M M M MMMMM M MM mmmmmmmM
;; M MMMMMMMM M M M MMMMP M M` MMMM
;; M MMMMMMMM M M M MMMM' .M MM MMMMMMMM
;; M MMMMMMMM M M M MMP' .MM MM MMMMMMMM
;; M M M M M .dMMM MM .M
;; MMMMMMMMMMM MMMM MMMMMMMMMMM MMMMMMMMMMMM ")
(message (concat "\n\n" live-ascii-art-logo "\n\n"))
(add-to-list 'command-switch-alist
(cons "--live-safe-mode"
(lambda (switch)
nil)))
(setq live-safe-modep
(if (member "--live-safe-mode" command-line-args)
"debug-mode-on"
nil))
(setq initial-scratch-message "
;; I'm sorry, Emacs Live failed to start correctly.
;; Hopefully the issue will be simple to resolve.
;;
;; First up, could you try running Emacs Live in safe mode:
;;
;; emacs --live-safe-mode
;;
;; This will only load the default packs. If the error no longer occurs
;; then the problem is probably in a pack that you are loading yourself.
;; If the problem still exists, it may be a bug in Emacs Live itself.
;;
;; In either case, you should try starting Emacs in debug mode to get
;; more information regarding the error:
;;
;; emacs --debug-init
;;
;; Please feel free to raise an issue on the Gihub tracker:
;;
;; https://github.com/overtone/emacs-live/issues
;;
;; Alternatively, let us know in the mailing list:
;;
;; http://groups.google.com/group/emacs-live
;;
;; Good luck, and thanks for using Emacs Live!
;;
;; _.-^^---....,,--
;; _-- --_
;; < SONIC >)
;; | BOOOOOOOOM! |
;; \._ _./
;; ```--. . , ; .--'''
;; | | |
;; .-=|| | |=-.
;; `-=#$%&%$#=-'
;; | ; :|
;; _____.,-#%&$@%#&#~,._____
;; May these instructions help you raise
;; Emacs Live
;; from the ashes
")
(setq live-supported-emacsp t)
(when (version< emacs-version "24.4")
(setq live-supported-emacsp nil)
(setq initial-scratch-message (concat "
;; _.-^^---....,,--
;; _-- --_
;; < SONIC >)
;; | BOOOOOOOOM! |
;; \._ _./
;; ```--. . , ; .--'''
;; | | |
;; .-=|| | |=-.
;; `-=#$%&%$#=-'
;; | ; :|
;; _____.,-#%&$@%#&#~,._____
;;
;; I'm sorry, Emacs Live is only supported on Emacs 24.4+.
;;
;; You are running: " emacs-version "
;;
;; Please upgrade your Emacs for full compatibility.
;;
;; Latest versions of Emacs can be found here:
;;
;; OS X GUI - http://emacsformacosx.com/
;; OS X Console - via homebrew (http://mxcl.github.com/homebrew/)
;; brew install emacs
;; Windows - http://alpha.gnu.org/gnu/emacs/windows/
;; Linux - Consult your package manager or compile from source
"))
(let* ((old-file (concat (file-name-as-directory "~") ".emacs-old.el")))
(if (file-exists-p old-file)
(load-file old-file)
(error (concat "Oops - your emacs isn't supported. Emacs Live only works on Emacs 24.4+ and you're running version: " emacs-version ". Please upgrade your Emacs and try again, or define ~/.emacs-old.el for a fallback")))))
(let ((emacs-live-directory (getenv "EMACS_LIVE_DIR")))
(when emacs-live-directory
(setq user-emacs-directory emacs-live-directory)))
(when live-supported-emacsp
;; Store live base dirs, but respect user's choice of `live-root-dir'
;; when provided.
(setq live-root-dir (if (boundp 'live-root-dir)
(file-name-as-directory live-root-dir)
(if (file-exists-p (expand-file-name "manifest.el" user-emacs-directory))
user-emacs-directory)
(file-name-directory (or
load-file-name
buffer-file-name))))
(setq
live-tmp-dir (file-name-as-directory (concat live-root-dir "tmp"))
live-etc-dir (file-name-as-directory (concat live-root-dir "etc"))
live-pscratch-dir (file-name-as-directory (concat live-tmp-dir "pscratch"))
live-lib-dir (file-name-as-directory (concat live-root-dir "lib"))
live-packs-dir (file-name-as-directory (concat live-root-dir "packs"))
live-autosaves-dir(file-name-as-directory (concat live-tmp-dir "autosaves"))
live-backups-dir (file-name-as-directory (concat live-tmp-dir "backups"))
live-custom-dir (file-name-as-directory (concat live-etc-dir "custom"))
live-load-pack-dir nil
live-disable-zone nil)
;; create tmp dirs if necessary
(make-directory live-etc-dir t)
(make-directory live-tmp-dir t)
(make-directory live-autosaves-dir t)
(make-directory live-backups-dir t)
(make-directory live-custom-dir t)
(make-directory live-pscratch-dir t)
;; Load manifest
(load-file (concat live-root-dir "manifest.el"))
;; load live-lib
(load-file (concat live-lib-dir "live-core.el"))
;;default packs
(let* ((pack-names '("foundation-pack"
"colour-pack"
"lang-pack"
"power-pack"
"git-pack"
"org-pack"
"clojure-pack"
"bindings-pack"))
(live-dir (file-name-as-directory "stable"))
(dev-dir (file-name-as-directory "dev")))
(setq live-packs (mapcar (lambda (p) (concat live-dir p)) pack-names) )
(setq live-dev-pack-list (mapcar (lambda (p) (concat dev-dir p)) pack-names) ))
;; Helper fn for loading live packs
(defun live-version ()
(interactive)
(if (called-interactively-p 'interactive)
(message "%s" (concat "This is Emacs Live " live-version))
live-version))
;; Load `~/.emacs-live.el`. This allows you to override variables such
;; as live-packs (allowing you to specify pack loading order)
;; Does not load if running in safe mode
(let* ((pack-file (concat (file-name-as-directory "~") ".emacs-live.el")))
(if (and (file-exists-p pack-file) (not live-safe-modep))
(load-file pack-file)))
;;
;; Uncomment next command to use dev packs
;;
;; (live-use-dev-packs)
;; Load all packs - Power Extreme!
(mapc (lambda (pack-dir)
(live-load-pack pack-dir))
(live-pack-dirs))
(setq live-welcome-messages
(if (live-user-first-name-p)
(list (concat "Hello " (live-user-first-name) ", somewhere in the world the sun is shining for you right now.")
(concat "Hello " (live-user-first-name) ", it's lovely to see you again. I do hope that you're well.")
(concat (live-user-first-name) ", turn your head towards the sun and the shadows will fall behind you.")
)
(list "Hello, somewhere in the world the sun is shining for you right now."
"Hello, it's lovely to see you again. I do hope that you're well."
"Turn your head towards the sun and the shadows will fall behind you.")))
(defun live-welcome-message ()
(nth (random (length live-welcome-messages)) live-welcome-messages))
(when live-supported-emacsp
(setq initial-scratch-message (concat live-ascii-art-logo " Version " live-version
(if live-safe-modep
"
;; --*SAFE MODE*--"
"
;;"
) "
;; http://github.com/overtone/emacs-live
;;
;; " (live-welcome-message) "
")))
)
(if (not live-disable-zone)
(add-hook 'term-setup-hook 'zone))
(if (not custom-file)
(setq custom-file (concat live-custom-dir "custom-configuration.el")))
(when (file-exists-p custom-file)
(load custom-file))
(message "\n\n Pack loading completed. Your Emacs is Live...\n\n")
(put 'downcase-region 'disabled nil)