1

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
  • 21,348
  • 34
  • 85
  • 121

2 Answers2

1

As far as I know GNU Emacs does not have a hook for loss of focus, but window managers usually provide a way to detect a change of the active application window. If you find out how you can do it with your window manager then it's only a matter of calling emacsclient and telling the running emacs to save the current buffer.

Tom
  • 7,515
  • 7
  • 38
  • 54
0

Emacs does this. The feature is called autosave. Your Emacs session is always autosaved whenever Emacs crashes or per ## keystrokes. See docs

Emacs has no loss of focus hook, so that part of it is not possible. And I've never wished it otherwise. ;-)

event_jr
  • 17,467
  • 4
  • 47
  • 62
  • "I've never wanted that" is not a legitimate answer to someone elses question. Plus the OP calls out the autosave file as being insufficient. – P.T. Jul 03 '12 at 16:10
  • 2
    If I hadn't explained why his original question is not possible in Emacs, your criticism would be valid. He mentioned autosave but clearly had not configured it properly, as it exactly fulfills the second part of his question. – event_jr Jul 03 '12 at 16:16
  • 1
    I also think this is actual answer for emacs since emacs does save files automatically as @event_jr says .. – kindahero Jul 03 '12 at 16:23
  • 1
    I looking for a back up. I am looking for my file to automatically saved, so that my file can be loaded in a browser and will reflect my changes without explicitly having to save. – Spencer Jul 03 '12 at 17:59