Move as much into python as possible.

This is because you cannot easily check the return statement from a
python funtion in VimL.
Sort out fold markers.
Reload the buffer on p4 edit and p4 revert.