Emacs: save on losing focus


I've gotten used to how IntelliJ IDEA saves files when it loses focus. I never have to remember to save files anymore. Given that most machines are fast enough that saving a file takes only a few milliseconds, I'd like to see this practice adopted in more programs. Since I still use XEmacs, and it's usually infinitely customizable, I decided to see if it was possible to write some elisp to do this. And it is indeed possible, and easy:

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

(add-hook 'deselect-frame-hook 'dld-deselect-frame-hook)
blog comments powered by Disqus

About this Entry

This page contains a single entry by Dave published on September 10, 2003 2:58 PM.

Putting Web Services on Ice was the previous entry in this blog.

Nice Java is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.


Powered by Movable Type 4.1