I have done this before using the macro defined by the keyboard. I would upload all the files to emacs (something like find . -name "*.cpp" | xargs emacs ) and then enter the following keys. I annotated each key combination with what it does.
Cx-( 'Begin recording macro M-< 'Go to start of file C-space 'Mark current location (now start of file) M-> 'Go to end of file Mx indent-region 'Indent entire file according to coding style Cx Cs 'Save the current buffer Cx Ck 'Close the current buffer Cx-) 'End recording macro
Now you can run this in the buffer by typing Cx e . If you have downloaded multiple files, you can run something like Cu 100 Cx e to run it on 100 files. If this is more than the number of files, this is normal, you just get some βcallβ or other error that you can ignore after all the processing is complete.
Alex b
source share