I have a bunch of rather verbose xml files that are named in a certain way like "verbosefile_*.xml". I have a pair of python scripts that transform these xml files into a compact json format and vice versa. Currently my workflow is that I first convert the verbose xml file into a compact json file using my script, make changes or edits to that file, and then convert the compact json version back to the verbose xml format. I wanted this process to happen transparently whenever I visit/open a file in emacs. Basically, my new workflow should be that upon opening the verbose xml files directly from the editor, I should see the compact json representation, and upon writing the file, the json should be converted behind the scenes to the verbose xml format and written. Some hints on how to do this would be great. I am new to elisp and the emacs hooks/functions, even if I have been using the editor for some time.
EDIT: I can change the python scripts to make things easier. For example, if the scripts working on std input makes the problem easier to solve, I can do that.
start-process: gnu.org/software/emacs/manual/html_node/elisp/…hexl-mode. This is a hex editor that use an external command to dump a file to a human-readable format and, upon saving, convert it back again.