Basically, we call emacs in batch mode, hand in the content of the VHDL file over stdin and retrieve the formatted code over stdout.