Autosaving on emacs or xemacs files (preferably on loss of focus)

2

Ideally I want to replicate with emacs functionality from TextMate, whereby on loss of focus i.e. I click away from the buffer, my file saves.

If this isn't possible, I want to customize emacs so that it will autosave the file for every character I write. When I say this I don't mean I want to autosave to the ~ backup files. I want to save the file I am currently working on.

I am working on a Fedora VM.

Note I am not looking for a backup or autosave. I want the file I am actually in to save, so that if I loaded the html file I am editing in a web browser it would reflect my new changes without me having to explicitly change it.

Spencer

Posted 2012-07-03T19:19:56.283

Reputation: 213

Answers

0

According to this blog post it's possible, but this solution only works with XEmacs. Here's the code:

(defun dld-deselect-frame-hook ()
  (save-some-buffers 1))

(add-hook 'deselect-frame-hook 'dld-deselect-frame-hook)

cYrus

Posted 2012-07-03T19:19:56.283

Reputation: 18 102

This didn't work for me. – Spencer – 2012-07-03T20:17:43.617