pre-commit-elisp – Pre-commit hooks for Emacs Lisp (Elisp) Git repositories

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

  1. Install pre-commit.
  2. 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-indentCode language: YAML (yaml)
  1. Install the hooks in your project:
pre-commit installCode language: plaintext (plaintext)
  1. Run hooks manually on all files (optional):
pre-commit run --all-filesCode language: plaintext (plaintext)