The pre-commit-elisp repository offers pre-commit hooks for Emacs Lisp (Elisp) projects. These hooks enforce code quality and consistency by performing automated checks on .el
files prior to committing changes:
elisp-check-parens
: Validates that all parentheses in.el
files are correctly balanced.elisp-byte-compile
: Byte-compiles.el
files to identify compilation errors early.elisp-indent
: Reindents.el
files to adhere to standard Emacs Lisp formatting conventions.
These pre-commit hooks enforce syntactic correctness, successful byte-compilation, and consistent code formatting, ensuring a high standard of code quality and maintainability throughout the repository.
Installation
- Install pre-commit.
- Add this repository as a local hook in your
.pre-commit-config.yaml
:
---
repos:
- repo: https://github.com/jamescherti/pre-commit-elisp
rev: v1.0.0
hooks:
- id: elisp-check-parens
- id: elisp-byte-compile
# Optional:
# NOTE: This change the indentation.
# - id: elisp-indent
Code language: YAML (yaml)
- Install the hooks in your project:
pre-commit install
Code language: plaintext (plaintext)
- Run hooks manually on all files (optional):
pre-commit run --all-files
Code language: plaintext (plaintext)