From 02cf1cb1eb8e5611a30b8089228623493fbc771d Mon Sep 17 00:00:00 2001 From: Vaino Kauppila Date: Thu, 10 Sep 2026 14:42:46 +0300 Subject: Import existing ~/.emacs as baseline, add tracking tooling Byte-identical import of the live ~/.emacs (Emacs 31.1, loads clean in batch and GUI apart from warnings noted in README). Tooling: check.sh (batch-load validation), install.sh (backup + symlink ~/.emacs -> emacs.el), Makefile, README. --- install.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 install.sh (limited to 'install.sh') diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..8a25c20 --- /dev/null +++ b/install.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Deploy emacs.el from this repo as ~/.emacs. +# +# Uses a symlink instead of a copy, so ~/.emacs is ALWAYS the latest +# version in this repo -- no reinstall needed after pulls or commits. +# Bonus: edits made inside Emacs (e.g. M-x customize writing +# custom-set-variables) land in this repo's working tree and show up +# in `git diff`, ready to be committed. +set -euo pipefail + +REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SOURCE="$REPO_DIR/emacs.el" +TARGET="$HOME/.emacs" +BACKUP_DIR="$REPO_DIR/backups" + +if [ ! -f "$SOURCE" ]; then + echo "ERROR: $SOURCE not found" >&2 + exit 1 +fi + +# Already installed? +if [ "$(readlink "$TARGET" 2>/dev/null || true)" = "$SOURCE" ]; then + echo "~/.emacs already points at this repo. Nothing to do." + exit 0 +fi + +# Back up any existing config before replacing it +if [ -e "$TARGET" ] || [ -L "$TARGET" ]; then + mkdir -p "$BACKUP_DIR" + BACKUP="$BACKUP_DIR/emacs-$(date +%Y%m%d-%H%M%S)" + mv "$TARGET" "$BACKUP" + echo "Backed up existing config to $BACKUP" +fi + +ln -s "$SOURCE" "$TARGET" +echo "Installed: ~/.emacs -> $SOURCE" -- cgit v1.3