2021-11-02 00:27:14 +00:00
|
|
|
#!/usr/bin/env bash
|
2021-11-10 22:24:55 +00:00
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# INITIALIZE the HAMACS SYSTEM
|
|
|
|
# ----------------------------------------------------------------------
|
2021-11-02 00:27:14 +00:00
|
|
|
|
2024-06-04 18:47:54 +00:00
|
|
|
# shellcheck disable=SC2164
|
2021-11-02 00:27:14 +00:00
|
|
|
HAMACS_DIR=$(cd "$(dirname "$0")"; pwd)
|
2022-03-03 23:16:50 +00:00
|
|
|
HAMACS_DEST=$HOME/.emacs.d
|
2021-11-02 00:27:14 +00:00
|
|
|
|
2024-06-04 18:47:54 +00:00
|
|
|
cd "$HAMACS_DIR"
|
|
|
|
mkdir -p "$HAMACS_DEST"
|
2021-11-10 22:24:55 +00:00
|
|
|
|
|
|
|
for LINK in snippets templates elisp
|
|
|
|
do
|
2024-06-04 18:47:54 +00:00
|
|
|
echo "Symlinking $HAMACS_DEST/$LINK to $HAMACS_DIR/$LINK ..."
|
|
|
|
rm -rf "${HAMACS_DEST:-~}/$LINK"
|
|
|
|
ln -s "$HAMACS_DIR/$LINK" "$HAMACS_DEST"
|
2021-11-10 22:24:55 +00:00
|
|
|
done
|
2021-11-02 00:27:14 +00:00
|
|
|
|
2024-06-04 18:47:54 +00:00
|
|
|
echo Download the public keys:
|
|
|
|
gpg --homedir ~/.emacs.d/elpa/gnupg --receive-keys 066DAFCB81E42C40
|
|
|
|
|
|
|
|
cat > "$HAMACS_DEST/early-init.el" <<EOF
|
2023-02-23 17:28:00 +00:00
|
|
|
;;; early-init.el --- Hamacs Early Init -*- lexical-binding: t; -*-
|
2021-11-02 00:27:14 +00:00
|
|
|
;;
|
|
|
|
;;; Commentary:
|
|
|
|
;;
|
2023-02-23 17:28:00 +00:00
|
|
|
;; 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.
|
2021-11-02 00:27:14 +00:00
|
|
|
;;
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
;; We'll be using straight. So, we don't want duplicated package loading:
|
|
|
|
(setq package-enable-at-startup nil)
|
|
|
|
|
2021-11-09 16:21:08 +00:00
|
|
|
;; While I would rather program my configurations, sometimes the Emacs
|
2023-02-23 17:28:00 +00:00
|
|
|
;; menu system is _good enough_, but I want it in its own file:
|
2021-11-09 16:21:08 +00:00
|
|
|
|
|
|
|
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
|
|
|
|
(when (file-exists-p custom-file)
|
|
|
|
(load custom-file))
|
|
|
|
|
2023-02-23 17:28:00 +00:00
|
|
|
;; 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
|
2024-06-04 18:47:54 +00:00
|
|
|
echo "(add-to-list 'exec-path \"${P}\")" >> "$HAMACS_DEST/early-init.el"
|
2023-02-23 17:28:00 +00:00
|
|
|
done
|
|
|
|
|
2024-06-04 18:47:54 +00:00
|
|
|
cat >> "$HAMACS_DEST/early-init.el" <<EOF
|
2023-02-23 17:28:00 +00:00
|
|
|
;; Local Variables:
|
|
|
|
;; no-byte-compile: t
|
|
|
|
;; no-native-compile: t
|
|
|
|
;; no-update-autoloads: t
|
|
|
|
;; End:
|
|
|
|
|
|
|
|
;;; early-init.el ends here
|
|
|
|
EOF
|
|
|
|
|
2024-06-04 18:47:54 +00:00
|
|
|
echo "Created $HAMACS_DEST/early-init.el"
|
2021-11-09 16:21:08 +00:00
|
|
|
|
|
|
|
|
2024-06-04 18:47:54 +00:00
|
|
|
cat > "$HAMACS_DEST/init.el" <<EOF
|
2023-02-23 17:28:00 +00:00
|
|
|
;;; 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:
|
|
|
|
|
2021-11-02 00:27:14 +00:00
|
|
|
(defvar hamacs-source-dir "$HAMACS_DIR" "Where we be.")
|
|
|
|
|
2023-08-04 15:29:54 +00:00
|
|
|
;; Bug fixes for ORG (there always seems to be something):
|
|
|
|
(defvar native-comp-deferred-compilation-deny-list nil)
|
|
|
|
|
2024-06-04 18:47:54 +00:00
|
|
|
;; Allow the installation of unsigned packages, but verify the signature if possible:
|
|
|
|
(setq package-check-signature 'allow-unsigned)
|
|
|
|
|
2022-03-03 23:16:50 +00:00
|
|
|
;; 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))
|
2023-03-24 05:18:03 +00:00
|
|
|
(bootstrap-version 6))
|
2022-03-03 23:16:50 +00:00
|
|
|
(unless (file-exists-p bootstrap-file)
|
|
|
|
(with-current-buffer
|
|
|
|
(url-retrieve-synchronously
|
2023-03-24 05:18:03 +00:00
|
|
|
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
|
2022-03-03 23:16:50 +00:00
|
|
|
'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
|
|
|
|
|
2023-05-25 17:26:34 +00:00
|
|
|
(use-package org
|
|
|
|
;; TODO: Using the latest org-mode
|
|
|
|
;; :straight (:type built-in)
|
|
|
|
)
|
2022-03-03 23:16:50 +00:00
|
|
|
|
2021-11-02 00:27:14 +00:00
|
|
|
;; Let's rock:
|
|
|
|
(org-babel-load-file "$HAMACS_DIR/bootstrap.org")
|
|
|
|
|
2022-07-27 04:10:25 +00:00
|
|
|
(provide 'init)
|
|
|
|
;;; init.el ends here
|
2021-11-02 00:27:14 +00:00
|
|
|
EOF
|
|
|
|
|
2024-06-04 18:47:54 +00:00
|
|
|
echo "Created $HAMACS_DEST/init.el"
|