diff options
| author | Vaino Kauppila <vaino@vke.fi> | 2026-09-10 14:42:46 +0300 |
|---|---|---|
| committer | Vaino Kauppila <vaino@vke.fi> | 2026-09-10 14:42:46 +0300 |
| commit | 02cf1cb1eb8e5611a30b8089228623493fbc771d (patch) | |
| tree | 861bc665f0488e82a8b9a77e74e15d748530e7ff /check.sh | |
| download | emacs_setup-02cf1cb1eb8e5611a30b8089228623493fbc771d.tar.gz emacs_setup-02cf1cb1eb8e5611a30b8089228623493fbc771d.zip | |
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.
Diffstat (limited to 'check.sh')
| -rwxr-xr-x | check.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/check.sh b/check.sh new file mode 100755 index 0000000..d243171 --- /dev/null +++ b/check.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Validate emacs.el by loading it in a batch Emacs. +# Run this before committing changes to your config. +# +# PASS = file loads with exit 0 and no errors. +# Warnings are shown but do not fail the check. +set -uo pipefail + +REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +INIT="$REPO_DIR/emacs.el" +OUTPUT=$(mktemp) +trap 'rm -f "$OUTPUT"' EXIT + +timeout 180 emacs --batch -l "$INIT" >"$OUTPUT" 2>&1 +STATUS=$? + +echo "--- emacs --batch -l emacs.el (exit $STATUS) ---" +cat "$OUTPUT" +echo "--- end output ---" + +ERRORS=$(grep -cE "^(Error|error|Cannot open|File mode specification error)" "$OUTPUT") +WARNINGS=$(grep -c "^Warning" "$OUTPUT" || true) + +if [ "$STATUS" -eq 0 ] && [ "$ERRORS" -eq 0 ]; then + echo "PASS: config loads cleanly ($WARNINGS warning(s))" + exit 0 +else + echo "FAIL: config has errors (see output above)" + exit 1 +fi |
