diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-13 13:08:25 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-13 13:08:25 -0500 |
| commit | 9e4c58029785c418ad6dbdbff3988a8582388c34 (patch) | |
| tree | 66c40eb120ce1bca55f02fa7c8be771706d8029a | |
| parent | d22e74762125b2b308e9259b6f606ae7eaa2ba21 (diff) | |
| download | rulesets-9e4c58029785c418ad6dbdbff3988a8582388c34.tar.gz rulesets-9e4c58029785c418ad6dbdbff3988a8582388c34.zip | |
fix(elisp): byte-compile cross-project .el edits against their own modules
The validate-el hook only put the current project's roots on the load path, so editing an .el file from another project failed Phase 1 byte-compile on free-variable warnings: the file's own sibling modules weren't reachable. I added the edited file's directory and its parent to the load path. For in-project edits both are redundant (already covered by PROJECT_ROOT and its modules dir). They only do work when the file sits outside the current project root.
I left Phase 2's test runner alone. It discovers tests by stem under PROJECT_ROOT/tests, so a cross-project file's tests aren't found regardless of load path.
| -rwxr-xr-x | languages/elisp/claude/hooks/validate-el.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/languages/elisp/claude/hooks/validate-el.sh b/languages/elisp/claude/hooks/validate-el.sh index d6999ac..2529fcc 100755 --- a/languages/elisp/claude/hooks/validate-el.sh +++ b/languages/elisp/claude/hooks/validate-el.sh @@ -51,7 +51,12 @@ case "$f" in fi ;; *.el) + # -L the file's own directory (and a sibling project root for files + # under a tests/ subdir) so cross-project edits compile against their + # own modules, not just this project's. if ! output="$(emacs --batch --no-site-file --no-site-lisp \ + -L "$(dirname "$f")" \ + -L "$(dirname "$f")/.." \ -L "$PROJECT_ROOT" \ -L "$PROJECT_ROOT/modules" \ -L "$PROJECT_ROOT/tests" \ |
