3

There are a number of emacs-lisp checking utilities - for example:

  • checkdoc.
  • package-lint.
  • relint.
  • byte-code-compilation.

Are there existing ways to quickly run this on an entire project without having to access each individually (for every file)?

for example:

emacs-check-code *.el

... would run all the checkers on my elisp files in the current directly, reporting warnings to the console.


Note: I have my own WIP solution, but wanted to avoid reinventing the wheel.

ideasman42
  • 8,375
  • 1
  • 28
  • 105

1 Answers1

3

See the function batch-byte-compile which implements the last of your asks. It is invoked as

emacs --batch -f batch-byte-compile *.el

to compile all the *.el files in the current directory. If you want to byte-compile all the the .el files under the current directory, you can use find and shell facilities:

emacs --batch -f batch-byte-compile $(find . -type f -name '*.el')

If you have thousands of files, this might not work: you might have to split the invocation in order to keep the length of the command line under the maximum allowed, but in most cases it is fine.

The code of batch-byte-compile can serve as an example of how to implement the rest. Basically, it consumes every element of the command line and applies byte-compile-file to each .el file it finds. As long as each of your tools provides such a function, then you can build the same scaffolding around it to consume every element of the command line. Then you can use utilities like find and shell facilities for command line substitution like $(...) to build the command line that will be consumed.

NickD
  • 27,023
  • 3
  • 23
  • 42