-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinit.el
93 lines (77 loc) · 3.2 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
;;; init.el --- Emacs.d.
;;
;; Author: Sliim <[email protected]>
;; Version: 1.0.0
;; Keywords: emacs.d
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Personal Emacs configuration
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(when (version< emacs-version "24.1")
(error "Requires at least GNU Emacs 24.1"))
(when (version< emacs-version "27")
(package-initialize))
(defvar emacsd-dir (file-name-directory load-file-name)
"The root dir of Emacs.")
(defvar emacsd-modules-dir (expand-file-name "modules" emacsd-dir)
"Modules root directory.")
(defvar emacsd-core-dir (expand-file-name "core" emacsd-dir)
"Core library root directory.")
(defvar emacsd-elisp-dir (expand-file-name "elisp" emacsd-dir)
"My elisp code that I'm not packaged yet.")
(defvar emacsd-vendor-dir (expand-file-name "vendor" emacsd-dir)
"Vendor's code not packaged.")
(defvar emacsd-var-dir (expand-file-name "var" emacsd-dir)
"Var/ root directory.")
(defvar emacsd-themes-dir (expand-file-name "themes" emacsd-dir)
"Themes root directory.")
(defvar emacsd-cask-dir (expand-file-name ".cask" emacsd-dir)
"Cask root directory.")
(defvar emacsd-elpa-dir (expand-file-name
(concat (number-to-string emacs-major-version) "."
(number-to-string emacs-minor-version) "/elpa")
emacsd-cask-dir)
"Elpa packages root directory.")
(defvar emacsd-backup-dir (expand-file-name "backup" emacsd-var-dir)
"This folder stores all the backup files.")
(unless (file-exists-p emacsd-backup-dir)
(make-directory emacsd-backup-dir))
(defvar savefile-dir (expand-file-name "savefile" emacsd-var-dir)
"This folder stores all the automatically generated save/history-files.")
(unless (file-exists-p savefile-dir)
(make-directory savefile-dir))
(add-to-list 'custom-theme-load-path emacsd-themes-dir)
(add-to-list 'load-path emacsd-core-dir)
(add-to-list 'load-path emacsd-modules-dir)
(add-to-list 'load-path emacsd-elisp-dir)
(add-to-list 'load-path emacsd-vendor-dir)
(let ((default-directory emacsd-elpa-dir))
(normal-top-level-add-subdirs-to-load-path))
;; Use core libraries
(require 'emacsd-core)
(require 'emacsd-editor)
;; Load modules
(load (expand-file-name "modules.el" emacsd-dir))
;; Set and load custom file
(setq custom-file (expand-file-name "custom.el" emacsd-dir))
(load custom-file)
;; Load private config if exists
(let ((user-config-file "~/.emacsrc"))
(when (file-exists-p user-config-file)
(load-file user-config-file)))
;;; init.el ends here