A couple of years ago I lamented over the lack of frame focus hooks in Emacs. This prohibited us from implemented a feature like IntelliJ IDEA’s “auto-save on focus lost”, which was kind of frustrating as we’re generally assuming that everything is doable in Emacs! All this changes in Emacs 24.4 with the introduction of two new hooks - focus-in-hook and focus-out-hook. The first is triggered when