Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs - Autosave buffer every 5 seconds

How can we configure emacs to automatically save the unsaved changes every 5 seconds? I want the save the buffer and not the temporary file generated with ~

like image 542
18bytes Avatar asked Nov 05 '12 09:11

18bytes


People also ask

How often does Emacs autosave?

Emacs periodically saves all files that you are visiting; this is called auto-saving. Auto-saving prevents you from losing more than a limited amount of work if the system crashes. By default, auto-saves happen every 300 keystrokes, or after around 30 seconds of idle time.

What is Emacs buffer?

Buffers in Emacs editing are objects that have distinct names and hold text that can be edited. Buffers appear to Lisp programs as a special data type. You can think of the contents of a buffer as a string that you can extend; insertions and deletions may occur in any part of the buffer. See Text.


1 Answers

In ~/.emacs file make following changes.

(require 'auto-save-buffers)
(run-with-idle-timer 5 t 'auto-save-buffers) 
like image 129
specialscope Avatar answered Sep 28 '22 01:09

specialscope