-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.el
189 lines (131 loc) · 6.19 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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
;;; init.el --- A Personal Emacs Configuration -*- lexical-binding: t; -*-
;; =============================================================================
;; 2020, 2021, 2022, 2023, 2024
;; =============================================================================
;;; Commentary:
;;
;;; Code:
(let ((minver "27.1"))
(when (version< emacs-version minver)
(error "This Emacs configuration is based on v%s" minver))
)
;; =============================================================================
;; initial settings
;; =============================================================================
;; this is used to initiate the load-path setting for further require config
;; alias emacs='emacs -q --load "/path/to/init.el"'
(setq user-init-file (or load-file-name (buffer-file-name)))
(setq user-emacs-directory (file-name-directory user-init-file))
;; refer to https://emacs.stackexchange.com/a/4258/29715
;; initiate 'lisp' folder to the load-path
(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))
(defconst *dependencies-installation-enabled* nil) ; enable with t if you prefer
;; =============================================================================
;; require settings
;; =============================================================================
(require 'init-portable) ; portable Emacs settings
(when (string-equal (getenv "ELPA") "local")
(message "The built-in Org version: %s" (org-version)))
(when (string-equal (getenv "ELPA") "online")
;; use the latest version of Org
(add-to-list 'load-path (concat (getenv "GITHUB_WORKSPACE") "/src/org-mode/lisp"))
(require 'org)
(message "The latest Org version: %s" (org-version)))
(require 'init-load-path) ; load-path settings
(require 'init-pre) ; pre-startup settings
(require 'init-messages) ; *Messages* buffer settings
(require 'init-utils) ; utils configuration
(require 'init-timer-utils) ; timer utils
(require 'local-var nil 'noerror) ; allow users to provide an optional
; "local-var" containing personal variables
(require 'use-package) ; use-package initialization
(setq use-package-always-ensure t) ; install the package if it is not installed
(require 'local-packages nil 'noerror) ; allow users to provide an optional
; "local-packages" containing local
; packages
;; above must come before (require 'package) settings, as it involves package.el
;; which downloads packages from the package-archives
(require 'init-speed-up) ; speed-up settings
;; =============================================================================
;; package management
;; =============================================================================
(require 'package)
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
;; Official MELPA Mirror, in case necessary.
;;(add-to-list 'package-archives (cons "melpa-mirror" (concat proto "://www.mirrorservice.org/sites/melpa.org/packages/")) t)
(when (string-equal (getenv "ELPA") "local")
;; when running on GitHub w/ local elpa Actions config, overwrite above `package-archives'
(defvar myelpa-url (concat (getenv "GITHUB_WORKSPACE") "/myelpa/"))
(setq package-archives `(("myelpa" . ,myelpa-url))))
;; install straight.el
;; https://github.com/radian-software/straight.el#getting-started
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(when (or (string-equal (getenv "ELPA") "local")
(string-equal (getenv "STRAIGHT") "freeze"))
(let ((source (expand-file-name "straight/versions/my.el" user-emacs-directory))
(destination (expand-file-name "straight/versions/default.el" user-emacs-directory)))
(when (file-exists-p source)
(copy-file source destination t))))
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
(require 'init-packages) ; package management by using use-package
;; =============================================================================
;; require settings
;; =============================================================================
(require 'init-company) ; company completion related settings
(require 'init-dict) ; dict settings
(require 'init-display) ; display settings
(require 'init-encryption) ; encryption settings
(require 'init-evil) ; evil related config
(require 'init-font) ; font settings
(require 'init-gpg) ; GPG settings
(require 'init-ibuffer) ; IBuffer mode settings
(require 'init-org) ; Org-mode settings
(require 'init-plantuml) ; PlantUML settings
(require 'init-python) ; Python settings
(require 'init-reformatter) ; reformatter settings
(require 'init-sessions) ; session settings
(require 'init-shell) ; Shell settings
(require 'init-spelling) ; spelling settings
(require 'init-tags) ; tags related config
(require 'init-uuid) ; UUID settings
(require 'init-veracrypt) ; VeraCrypt/TrueCrypt settings
(require 'init-yaml) ; YAML settings
(require 'init-misc) ; miscellaneous settings
(require 'local-config nil 'noerror) ; allow users to provide an optional
; "local-config" containing personal
; settings
;; move the hooks to the end of the main settings
(require 'init-hooks) ; hooks settings
;; move the keybindings to the end of the other settings
(require 'init-keybindings) ; keybindings with general.el
(when *dependencies-installation-enabled*
(require 'init-deps) ; dependencies installation
)
;; =============================================================================
;; footer
;; =============================================================================
(when (file-exists-p custom-file)
;; stop adding "custom" fields to the end
;; variables configured via the interactive 'customize' interface
(load custom-file))
(provide 'init)
;; Local Variables:
;; coding: utf-8
;; no-byte-compile: t
;; End:
;;; init.el ends here