-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnunb-loader.el
37 lines (27 loc) · 1.35 KB
/
nunb-loader.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
;; Where is this nunb-loader file?
(setq loader-dir (file-name-directory
(or (buffer-file-name) load-file-name)))
;; FAILED EXPERIMENTS
;; (setq loader-dir default-directory)
;; --> no, this is the failure, because it doesn't work when -q -l opts are used.
;; defaulting to this file's dir, or emacsen
(defun nunb-set-loadpath-all-under (loaddir)
"Takes a dir, and loads all of its subdirs into the load-path"
(if (fboundp 'normal-top-level-add-subdirs-to-load-path)
(let* ((my-lisp-dir (or loaddir loader-dir "~/emacsen/"))
(default-directory my-lisp-dir)
(orig-load-path load-path))
(setq load-path (cons my-lisp-dir nil))
(normal-top-level-add-subdirs-to-load-path)
(nconc load-path orig-load-path))))
;; Load user and system specific customizations
(setq system-specific-config (concat loader-dir system-name ".el")
user-specific-config (concat loader-dir user-login-name ".el")
user-specific-dir (concat loader-dir user-login-name))
(add-to-list 'load-path user-specific-dir)
(defun nunb-load-system-and-user () ;; From ESK
(if (file-exists-p system-specific-config) (load system-specific-config))
(if (file-exists-p user-specific-config) (load user-specific-config))
(if (file-exists-p user-specific-dir)
(mapc #'load (directory-files user-specific-dir nil ".*el$"))))
(provide 'nunb-loader)