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)