-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.el
76 lines (59 loc) · 3.17 KB
/
init.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
;;; init.el --- Load the configuration -*- lexical-binding: t -*-
;;; Commentary:
;; This init.el wraps the tmn.el configuration and supports loading
;; different user Emacs directories by exporting USER_EMACS_DIRECTORY
;; to another directory than the default .emacs.d.
;;; Code:
;; -----------------------------------------------------------------------------
;; Default coding system
;; -----------------------------------------------------------------------------
(set-default-coding-systems 'utf-8)
(server-start)
(let ((alternative-user-emacs-directory (getenv "USER_EMACS_DIRECTORY")))
(defvar t/config-file-loaded-p nil)
(cond
((and (not after-init-time) t/config-file-loaded-p))
(alternative-user-emacs-directory
(setq alternative-user-emacs-directory
(file-name-as-directory alternative-user-emacs-directory))
(setq user-emacs-directory alternative-user-emacs-directory)
(setq user-init-file (expand-file-name "init.el" user-emacs-directory))
(load user-init-file 'noerror 'nomessage))
(t
(setq t/config-file-loaded-p t)
(defvar t/minimum-emacs-version "29.0"
"The tmn.el configuration does not support any Emacs version below this.")
(if (version< emacs-version t/minimum-emacs-version)
(error (concat "Your Emacs is too old -- "
"this config requires v%s or higher")
t/minimum-emacs-version)
;; -----------------------------------------------------------------------------
;; Load OS specific settings
;; -----------------------------------------------------------------------------
(when (eq system-type 'darwin)
(let ((t/lib-file (concat user-emacs-directory "osx.el")))
(unless (file-exists-p t/lib-file)
(error "No file found: %s" t/lib-file))
(load (expand-file-name "osx.el" user-emacs-directory) nil 'nomessage 'nosuffix)))
(when (eq system-type 'windows-nt)
(let ((t/lib-file (concat user-emacs-directory "osx.el")))
(unless (file-exists-p t/lib-file)
(error "No file found: %s" t/lib-file))
(load (expand-file-name "windows.el" user-emacs-directory) nil 'nomessage 'nosuffix)))
(when (eq system-type 'gnu/linux)
(let ((t/lib-file (concat user-emacs-directory "osx.el")))
(unless (file-exists-p t/lib-file)
(error "No file found: %s" t/lib-file))
(load (expand-file-name "linux.el" user-emacs-directory) nil 'nomessage 'nosuffix)))
;; (when (eq system-type 'windows-nt)
;; (load (expand-file-name "windows.el" user-emacs-directory) nil 'nomessage 'nosuffix))
;; (when (eq system-type 'gnu/linux)
;; (load (expand-file-name "linux.el" user-emacs-directory) nil 'nomessage 'nosuffix))
;; -----------------------------------------------------------------------------
;; Load THE config
;; -----------------------------------------------------------------------------
(let ((t/lib-file (concat user-emacs-directory "tmn.el")))
(unless (file-exists-p t/lib-file)
(error "No file found: %s" t/lib-file))
(load t/lib-file nil 'nomessage 'nosuffix))))))
;;; init.el ends here