Files
memex/projects/check-parens

check-parens

Standalone parentheseis checker for Lisp source blocks in Org files.

Scans all #+begin_src lisp … #+end_src blocks in an Org file, strips string and comment content, and reports unbalanced parentheses per block.

== Usage

  check-parens <file.org> [<file.org> ...]
  check-parens -v <file.org>

Exit 0 if all blocks are balanced and terminated, 1 otherwise.

== Output

file.org: OK — all blocks balanced file.org: Block at line 27: +2 (missing 2 closes) — near … file.org: Block at line 103: unterminated — no matching #+end_src

The -v flag prints the full block content for each issue.

== Integration

Pre-commit hook:

  cat > .git/hooks/pre-commit <<'HOOK'
  #!/bin/sh
  for f in $(git diff --cached --name-only --diff-filter=ACM | grep '\.org$'); do
    projects/check-parens/check-parens "$f" || exit 1
  done
  HOOK
  chmod +x .git/hooks/pre-commit

== Dependencies

Python 3 + SBCL (for the reader-based validation). SBCL must be at `/usr/bin/sbcl` (the default path).