stsquad/emacs_chrome — Issue #44: C-x C-s should not destroy data
Author: tarsius
Created: 2011-10-23 21:43:45+00:00
State: open

I have just used edit-server.el again after a very long time. Unfortunately I was quickly reminded of why I stopped using it:

I used edit-server to write a really long message. It was very pleasant much more pleasant than using a textarea.

Then out of habit I tried to save my work - and it's a good habit. I pressed C-x C-s to save the current buffer. Unfortunately I had previously somehow closed the chrome tab containing the textarea. So edit-server killed the buffer and send it's content into nirvana because the textarea where it was supposed to yank the buffer-string had vanished.

Many things can go wrong when editing text - some can be user errors like me removing the output textarea or it could be Emacs or Chrome crashing. Emacs is usually very good at dealing with crashes - a recent version of files being edited can always be recovered.

I tried to do the this here too but in this case I could not recover anything. Maybe I have done something wrong since I was panicking a bit. But it does not mater because

I pressed Emacs' default key binding for SAVING resulting in edit-server DESTROYING my data.

This should simply not happen.

First step: do NOT rebind C-x C-s to a command that under some circumstances destroys data.

Step two: ensure that edit-server uses Emacs backup facility to the fullest. I believe this means that the buffer has to be associated with a file. So be it. Create a tempory file in ~/.emacs.d/edit-server-saves. By default NEVER remove any files from there. Maybe provide an option to clean out files older than x days or something like that - but default to not destroy the users data.