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.