1

How can I setup Emacs >= 24.4 so that it saves at least the current file I'm working on automatically, say, each 5 seconds, so that I don't have to press C-x C-s each time to save my changes?

Oskar K.
  • 278
  • 1
  • 7
  • Related: [Automatically saving the current file after typing a certain number of characters](http://emacs.stackexchange.com/questions/7821/automatically-saving-the-current-file-after-typing-a-certain-number-of-character). – Dan May 10 '16 at 10:44

1 Answers1

4

You probably do not want it to save every N sec but to do that only after Emacs has been idle for N sec.

To do that, customize user option auto-save-timeout to the number of seconds, and turn on auto-save-mode.

See the Emacs manual (C-h r), node Auto Save and its children, especially node Auto Save Control.

See also the Elisp manual, node Auto-Saving, which details the user options and functions used for auto-saving.

Drew
  • 75,699
  • 9
  • 109
  • 225
  • +1 for "you probably don't want to do that." `auto-save`, as @Drew suggests, provides the functionality you probably want. – Dan May 10 '16 at 10:47