-
Notifications
You must be signed in to change notification settings - Fork 3
/
initialize
executable file
·121 lines (94 loc) · 3.49 KB
/
initialize
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
#!/usr/bin/env bash
# ----------------------------------------------------------------------
# INITIALIZE the HAMACS SYSTEM
# ----------------------------------------------------------------------
# shellcheck disable=SC2164
HAMACS_DIR=$(cd "$(dirname "$0")"; pwd)
HAMACS_DEST=$HOME/.emacs.d
cd "$HAMACS_DIR"
mkdir -p "$HAMACS_DEST"
for LINK in snippets templates elisp
do
echo "Symlinking $HAMACS_DEST/$LINK to $HAMACS_DIR/$LINK ..."
rm -rf "${HAMACS_DEST:-~}/$LINK"
ln -s "$HAMACS_DIR/$LINK" "$HAMACS_DEST"
done
echo Download the public keys:
gpg --homedir ~/.emacs.d/elpa/gnupg --receive-keys 066DAFCB81E42C40
cat > "$HAMACS_DEST/early-init.el" <<EOF
;;; early-init.el --- Hamacs Early Init -*- lexical-binding: t; -*-
;;
;;; Commentary:
;;
;; This is my early Emacs configuration file. See init.el for the real
;; boot process. Since we are using straight or elpaca, we just need to
;; stop the normal package process.
;;
;;; Code:
;; We'll be using straight. So, we don't want duplicated package loading:
(setq package-enable-at-startup nil)
;; While I would rather program my configurations, sometimes the Emacs
;; menu system is _good enough_, but I want it in its own file:
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file))
;; Let's build the \`exec-path' from the _real_ shell path:
EOF
IFS=":" read -r -a PATH_ARRAY <<< "${PATH}"
for P in "${PATH_ARRAY[@]}"
do
echo "(add-to-list 'exec-path \"${P}\")" >> "$HAMACS_DEST/early-init.el"
done
cat >> "$HAMACS_DEST/early-init.el" <<EOF
;; Local Variables:
;; no-byte-compile: t
;; no-native-compile: t
;; no-update-autoloads: t
;; End:
;;; early-init.el ends here
EOF
echo "Created $HAMACS_DEST/early-init.el"
cat > "$HAMACS_DEST/init.el" <<EOF
;;; init.el --- Hamacs Init -*- lexical-binding: t; -*-
;;
;;; Commentary:
;;
;; This is my Emacs Bootloader. Simply put, I initialize the package management
;; system, and then tangle my literate files. This simple idea came from
;; https://github.com/susamn/dotfiles
;;
;;; Code:
(defvar hamacs-source-dir "$HAMACS_DIR" "Where we be.")
;; Bug fixes for ORG (there always seems to be something):
(defvar native-comp-deferred-compilation-deny-list nil)
;; Allow the installation of unsigned packages, but verify the signature if possible:
(setq package-check-signature 'allow-unsigned)
;; Configure straight https://github.com/raxod502/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))
(straight-use-package 'use-package)
;; While that enables the :straight t extension to use-package, let's just have that be the default:
(use-package straight
:custom (straight-use-package-by-default t
straight-default-vc 'git))
;; See the details in https://dev.to/jkreeftmeijer/emacs-package-management-with-straight-el-and-use-package-3oc8
(use-package org
;; TODO: Using the latest org-mode
;; :straight (:type built-in)
)
;; Let's rock:
(org-babel-load-file "$HAMACS_DIR/bootstrap.org")
(provide 'init)
;;; init.el ends here
EOF
echo "Created $HAMACS_DEST/init.el"