How to Recover Old Version of File in El Capitan without Backups?
No success in restoring the file, like patrix points out. 
So regular daily backups is the way to go to prevent loss of data. 
However, this cannot only be the measure in the long-run. 
We need to understand why such an occasion occurs. 

Suggestion for improvements in Text Editor, Python and LaTeX

I think the reason for the corruption of the file was the shebang --shell-escape inside TextMate but also because of LaTeX community. There are many other tickets in TextMate which should be fixed so this one is not in the high list. So I just do not use "always" the shebang for Python because of the danger of losing data.
We should


understand how to limit the rights of --shell-escape
understand how to have Python in inside LaTeX without full shell rights
much more error tests are needed for tracking down this error
active text editor development with open/community development


I think this is not only the editor' fault. I think this is also LaTeX community task because they allow in the first place python in the .tex document with too wide permissions. 
I think the current method should be better implemented because of such damages. 
I think we need pythonLatex or something else because importing whole python in LaTeX is dangerous currently without Unit tests. 


I propose Unit tests for LaTeX documents. This could help me to understand between the integration with Python and LaTeX, and with text editor