Repository navigation
Expand file tree
/
Copy pathpacks.el
More file actions
126 lines (105 loc) · 4.81 KB
/
Copy pathpacks.el
File metadata and controls
126 lines (105 loc) · 4.81 KB
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
;; Emacs LIVE
;;
;; This is where everything starts. Do you remember this place?
;; It remembers you...
;; Store live base dirs
(setq live-root-dir (file-name-directory
(or (buffer-file-name) load-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-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-load-pack-dir 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)
;; Helper fn for loading live packs
(defun live-pack-config-dir ()
"Returns the path of the config dir for the current pack"
(file-name-as-directory (concat live-load-pack-dir "config")))
(defun live-pack-lib-dir ()
"Returns the path of the lib dir for the current pack"
(file-name-as-directory (concat live-load-pack-dir "lib")))
(defun live-load-pack (pack-name)
"Load a live pack. This is a dir that contains at least a file
called init.el. Adds the packs's lib dir to the load-path"
(let* ((pack-name (if (symbolp pack-name)
(symbol-name pack-name)
pack-name))
(pack-name-dir (if (file-name-absolute-p pack-name)
(file-name-as-directory pack-name)
(file-name-as-directory (concat live-packs-dir pack-name))))
(pack-init (concat pack-name-dir "init.el")))
(setq live-load-pack-dir pack-name-dir)
(add-to-list 'load-path (live-pack-lib-dir))
(if (file-exists-p pack-init)
(load-file pack-init))
(setq live-load-pack-dir nil)))
(defun live-add-pack-lib (p)
"Adds the path (specified relative to the the pack's lib dir)
to the load-path"
(add-to-list 'load-path (concat (live-pack-lib-dir) p)))
(defun live-load-config-file (f-name)
"Load the config file with name f-name in the current pack"
(let* ((config-dir (live-pack-config-dir)))
(load-file (concat config-dir f-name))))
(defun live-use-packs (pack-list)
"Use the packs in pack-list - overrides the defaults and any
previous packs added with live-add-packs."
(setq live-packs pack-list))
(defun live-add-packs (pack-list)
"Add the list pack-list to end of the current list of packs to
load"
(setq live-packs (append live-packs pack-list)))
;; Load `~/.emacs-live.el`. This allows you to override variables such
;; as live-packs (allowing you to specify pack loading order)
;; (let* ((pack-file (concat (file-name-as-directory "~") ".emacs-live.el")))
;; (if (file-exists-p pack-file)
;; (load-file pack-file)))
(defun live-load-all-packs (live-packs)
(mapcar (lambda (pack-name) (live-load-pack pack-name)) live-packs)
; user is last
(live-load-pack "user"))
(defun live-user-first-name ()
(car (split-string user-full-name)))
(setq live-welcome-messages
(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) ", this could be the beginnings of a great hacking session.")
(concat (live-user-first-name) ", may the source be with you; the force, aka GNU Emacs is at your command.")
(concat (live-user-first-name) ", 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))
(setq initial-scratch-message (concat ";; 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
;;
;; http://github.com/jagguli/dotemacs
;;
;; " (live-welcome-message) "
" ))
;;(insert-file-contents "~/Dropbox/OrgMode/zen.org")
;;;
;;; Entry point
;;;
;;default live packs
;;(setq live-packs '("core" "themes" "power" "clojure" "programming" "notes"))
(setq live-packs '("core" "themes"))
;; Load all packs - Power Extreme!
(live-load-all-packs live-packs)