From 42086f187958249afc61c7eaa1c10e4ebbfd9238 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 19 Apr 2026 12:44:29 -0500 Subject: fix(elisp): call package-initialize so byte-compile finds deps Byte-compile needs external packages on the load path to resolve (require ...) forms in project files. Without this, any project using MELPA/ELPA packages (dash, s, etc.) failed Phase 1 with "Cannot open load file". package-initialize reads package-user-dir (default ~/.emacs.d/elpa) and exposes installed package autoloads. Small latency cost (~100ms) but makes the hook work on real projects. Verified: - chime.el (requires dash) now byte-compiles cleanly; was failing. - emacs.d modules still pass; no regression. --- languages/elisp/claude/hooks/validate-el.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'languages/elisp') diff --git a/languages/elisp/claude/hooks/validate-el.sh b/languages/elisp/claude/hooks/validate-el.sh index 956feaa..6f93d48 100755 --- a/languages/elisp/claude/hooks/validate-el.sh +++ b/languages/elisp/claude/hooks/validate-el.sh @@ -34,6 +34,7 @@ case "$f" in -L "$PROJECT_ROOT" \ -L "$PROJECT_ROOT/modules" \ -L "$PROJECT_ROOT/tests" \ + --eval '(package-initialize)' \ "$f" \ --eval '(check-parens)' \ --eval "(or (byte-compile-file \"$f\") (kill-emacs 1))" 2>&1)"; then @@ -75,6 +76,7 @@ if [ "$count" -ge 1 ] && [ "$count" -le "$MAX_AUTO_TEST_FILES" ]; then -L "$PROJECT_ROOT" \ -L "$PROJECT_ROOT/modules" \ -L "$PROJECT_ROOT/tests" \ + --eval '(package-initialize)' \ -l ert "${load_args[@]}" \ --eval "(ert-run-tests-batch-and-exit '(not (tag :slow)))" 2>&1)"; then printf 'TESTS FAILED for %s (%d test file(s)):\n%s\n' "$f" "$count" "$output" >&2 -- cgit v1.2.3