-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall.el
106 lines (94 loc) · 4.09 KB
/
all.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
;;; Master emacs loading file.
;;; Does very bare-bones setup (functions needed for the rest of the
;;; file), pulls in configuration environment variables, and executes
;;; per-system files (parallel to the all.bf system).
;;; Note that unlike the rest of the initialization, this file
;;; isn't automatically byte-compiled when it's out of date. Any
;;; changes to this file should involve byte compiling.
(defun randy-assert-file-ok (filename)
(if (not (file-exists-p filename))
(error "File %s does not exist" filename))
(if (not (file-readable-p filename))
(error "File %s is not readable" filename))
(let ((fa (file-attributes filename)))
(if (not fa)
(error "Attributes for file %s could not be read" filename))
(if (eq (car fa) t)
(error "File %s is a directory" filename))
(if (car fa)
(error "File %s is a symbolic link" filename))))
(defun compile-if-newer-then-load (file)
"Load the file specified (possibly compiling first)."
(let ((elfile (concat file ".el"))
(elcfile (concat file ".elc")))
(if (file-exists-p elfile)
(progn
(randy-assert-file-ok elfile)
(if (file-exists-p elcfile)
(randy-assert-file-ok elcfile))
(if (file-newer-than-file-p elfile elcfile)
(if (byte-compile-file elfile)
(load elcfile)
(load elfile))
(load elcfile))))))
;;; Backwards compatibility.
(defvar randy-configuration-directory (getenv "config_files_directory")
"The directory under which all configuration files can be found.")
(defvar randy-configuration-host (getenv "config_host")
"The bare (not FQ) hostname of the current host.")
(defvar randy-configuration-domain (getenv "config_domain")
"The domainname (without hostname) of the current host.")
(defvar randy-configuration-os (getenv "config_os")
"The operating system type of the current host.")
(defvar randy-configuration-arch (getenv "config_arch")
"The hardware archiecture of the current host.")
(defvar randy-configuration-fhost (getenv "force_host")
"The host that we should pretend to be (dealing with DHCP weirdnesses)")
(defvar randy-configuration-fdomain (getenv "force_domain")
"The domain that we should pretend to be (dealing with DHCP weirdnesses)")
(defun randy-init-directly (argconcat)
(let* ((dirspecdp (file-directory-p argconcat))
(filebase (cond (dirspecdp (concat argconcat "/all"))
((equal (substring argconcat -3) ".el")
(substring argconcat 0 -3))
((equal (substring argconcat -4) ".elc")
(substring argconcat 0 -4))
(t argconcat))))
(if (and dirspecdp (not (member argconcat load-path)))
(setq load-path (append load-path (list argconcat))))
(compile-if-newer-then-load filebase)))
(defun randy-init-from (subfile)
(randy-init-directly (concat randy-configuration-directory "/" subfile)))
(randy-init-from "Emacs")
(randy-init-from "pre-system")
;;; Read in everything the shell initiatlization has told us to
;(message (getenv "emacs_init_list"))
(let* ((files (or (getenv "emacs_init_list") ""))
(file-list (split-string files ":")))
(while file-list
;(message (concat "Initializing from " (car file-list)))
;(message "Length of list: %d" (length file-list))
(randy-init-directly (car file-list))
(setq file-list (cdr file-list))))
(randy-init-from "Emacs/rs-persist")
(randy-init-from "Emacs/rs-dirhist")
(randy-init-from "Emacs/rs-frames")
(randy-init-from "Emacs/rs-compile")
(randy-init-from "Emacs/rs-programs")
(randy-init-from "Emacs/rs-server")
(randy-init-from "Emacs/rs-man")
(randy-init-from "post-system")
(randy-init-from "Emacs/rs-keys") ; Keyboard mappings
;; Start emacs server if not running as daemon.
;; rs-server-start sets an emacs-specific environmental
;; variable for EDITOR. We avoid doing this if run as
;; a daemon, taking that as a request that there be only
;; one emacs on this machine.
(if (not (daemonp))
(rs-server-start)) ;Sets EDITOR in the environment.
;; Unilaterally enable winner mode.
(winner-mode t)
;; Unilaterally enable global auto-revert mode.
(global-auto-revert-mode 1)
;; Unilaterally track to first error in compilation buffer
(setq compilation-scroll-output 'first-error)