-
Notifications
You must be signed in to change notification settings - Fork 0
/
starter-kit.el
120 lines (92 loc) · 4.24 KB
/
starter-kit.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
(setq dotfiles-dir (file-name-directory
(or load-file-name (buffer-file-name))))
(add-to-list 'load-path dotfiles-dir)
(add-to-list 'load-path (concat dotfiles-dir "/elpa-to-submit"))
(add-to-list 'load-path (concat dotfiles-dir "/elpa-to-submit/jabber"))
(setq autoload-file (concat dotfiles-dir "loaddefs.el"))
(setq package-user-dir (concat dotfiles-dir "elpa"))
(setq custom-file (concat dotfiles-dir "custom.el"))
(require 'cl)
(require 'saveplace)
(require 'ffap)
(require 'uniquify)
(require 'ansi-color)
(require 'recentf)
(require 'dominating-file)
(defun starter-kit-load (file)
"This function is to be used to load starter-kit-*.org files."
(org-babel-load-file (expand-file-name file
dotfiles-dir)))
(defun starter-kit-compile (&optional arg)
"Tangle and Byte compile all starter-kit files."
(interactive "P")
(flet ((age (file)
(float-time
(time-subtract (current-time)
(nth 5 (or (file-attributes (file-truename file))
(file-attributes file)))))))
(mapc
(lambda (file)
(when (string= "org" (file-name-extension file))
(let ((el-file (concat (file-name-sans-extension file) ".el")))
(when (or arg
(not (and (file-exists-p el-file)
(> (age file) (age el-file)))))
(org-babel-tangle-file file el-file "emacs-lisp")
(byte-compile-file el-file)))))
(apply #'append
(mapcar
(lambda (d)
(when (and (file-exists-p d) (file-directory-p d))
(mapcar (lambda (f) (expand-file-name f d)) (directory-files d))))
(list (concat dotfiles-dir user-login-name) dotfiles-dir))))))
(require 'package)
(add-to-list 'package-archives '("original" . "http://tromey.com/elpa/"))
(add-to-list 'package-archives
'("technomancy" . "http://repo.technomancy.us/emacs/") t)
(package-initialize)
(starter-kit-load "starter-kit-elpa.org")
(if (eq system-type 'darwin)
(setq system-name (car (split-string system-name "\\."))))
(setq system-specific-config (concat dotfiles-dir system-name ".el")
system-specific-literate-config (concat dotfiles-dir system-name ".org")
user-specific-config (concat dotfiles-dir user-login-name ".el")
user-specific-literate-config (concat dotfiles-dir user-login-name ".org")
user-specific-dir (concat dotfiles-dir user-login-name))
(add-to-list 'load-path user-specific-dir)
(setq elisp-source-dir (concat dotfiles-dir "src"))
(add-to-list 'load-path elisp-source-dir)
(starter-kit-load "starter-kit-defuns.org")
(starter-kit-load "starter-kit-bindings.org")
(starter-kit-load "starter-kit-misc.org")
(starter-kit-load "starter-kit-registers.org")
(add-to-list 'load-path
(expand-file-name "yasnippet"
(expand-file-name "src"
dotfiles-dir)))
(require 'yasnippet)
(yas/initialize)
(yas/load-directory (expand-file-name "snippets" dotfiles-dir))
(starter-kit-load "starter-kit-org.org")
(starter-kit-load "starter-kit-eshell.org")
(starter-kit-load "starter-kit-lisp.org")
;;(starter-kit-load "starter-kit-haskell.org")
;;(starter-kit-load "starter-kit-ruby.org")
;;(starter-kit-load "starter-kit-js.org")
(starter-kit-load "starter-kit-perl.org")
(starter-kit-load "starter-kit-python.org")
;; (starter-kit-load "starter-kit-latex.org")
(load custom-file 'noerror)
(if (file-exists-p elisp-source-dir)
(let ((default-directory elisp-source-dir))
(normal-top-level-add-subdirs-to-load-path)))
(if (file-exists-p system-specific-config) (load system-specific-config))
(if (file-exists-p system-specific-literate-config)
(org-babel-load-file system-specific-literate-config))
(if (file-exists-p user-specific-config) (load user-specific-config))
(if (file-exists-p user-specific-literate-config)
(org-babel-load-file user-specific-literate-config))
(when (file-exists-p user-specific-dir)
(let ((default-directory user-specific-dir))
(mapc #'load (directory-files user-specific-dir nil ".*el$"))
(mapc #'org-babel-load-file (directory-files user-specific-dir nil ".*org$"))))