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

From: Glenn Morris <[email-masked]>
Date: Thu, 08 Aug 2013 12:15:06 -0400

Richard Stallman wrote:

>     We are talking about when the input focus enters and leaves Emacs in a
>     GUI environment.
>
> It's the same kind of issue.  I don't think Emacs should run any Lisp
> code when that happens -- it would make things hard to predict.

To me, It seems a perfectly reasonable request to want Emacs do certain
things (eg save all files) when it loses input focus.

As for debugging, same procedure as always: does it happen with emacs -Q?
If not, it's something in your config, so bisect .emacs until you find
the line that causes it.