-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-header.el
52 lines (40 loc) · 1.65 KB
/
init-header.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
;; functions
(defun rw-add-to-load-path (dir)
"add DIR to the head of load-path"
(add-to-list 'load-path dir))
(defun rw-add-subdirs-to-load-path (dir)
"add all subdirs of DIR to load-path, which begin with a digital or letter."
(let ((dir-files (directory-files dir t "^[0-9A-Za-z].*")))
(dolist (file dir-files)
(when (file-directory-p file)
(rw-add-to-load-path file)))))
(defun rw-add-dir-and-subdirs-to-load-path (dir)
"add DIR and all subdirs of DIR to load-path, which begin with a digital or letter."
(interactive "DDir:")
(rw-add-to-load-path dir)
(rw-add-subdirs-to-load-path dir))
(defun expand-directory-name (name &optional default-directory)
"Same as `expand-file-name', but make sure the return value endes with slash."
(let ((result (expand-file-name name default-directory)))
(if (not (string-suffix-p "/" result))
(concat result "/")
result)))
;; global variables
(defvar rice-wine-dir (expand-directory-name (file-name-directory load-file-name))
"top directory of configuration")
(defvar rice-wine-lisp-dir (expand-directory-name "layers" rice-wine-dir)
"configurations of packages")
(defvar rice-wine-package-dir
(expand-directory-name "site-lisp" rice-wine-dir)
"local packages")
(defvar rice-wine-git-package-dir
(expand-directory-name "git-lisp" rice-wine-dir)
"packages from git, which have higher priority than pakages in `rice-wine-package-dir'")
(defvar rice-wine-lib-dir
(expand-directory-name "lib" rice-wine-dir)
"library packages, mostly for elisp programming")
;; load libs
(rw-add-dir-and-subdirs-to-load-path rice-wine-lib-dir)
(require 'dash)
(require 's)
(require 'f)