Fixes autosave feature.

We currently trigger the autosave after the user stops writing for 1 second. Maybe it would be more convenient to trigger it every N second instead.

Solves issue #297.
Advances issue #322.