Subject: bug#15029: 24.3; feature-request: add window-focus-lost-hook

From: Stefan Monnier <[email-masked]>
Date: Fri, 09 Aug 2013 09:54:56 -0400

> post-command-hook is also used in narrow ways, and it doesn't
> cause anything strange to happen just because you move the mouse.

When I move the mouse from one frame to another, it generates
a `switch-frame' event, which is run by the perfectly normal command
handle-switch-frame, including running pre/post-command-hook.

> If I understand what mouse-autoselect-window does, it only causes
> switching windows -- it does not run Lisp code.

Same as above: runs pre/post-command-hook etc...

> What is a very useful application for running code when the mouse
> moves out of the Emacs frame?

Currently used to turn off the blink-cursor timer.
Other users want it to (auto-)save a file when its buffer/frame
loses focus.
Yet others want to change the frame's background color to indicate that
it has focus.

        Stefan