add/remove more hooks to turn-on and turn-off defuns

This properly sets the window dimming when using modes that implement
`next-error` by undimming the buffer of the error you are jumping to.

It will also dim all windows when you lose focus of Emacs 24.4+ and undim
the active buffer when you gain focus back. It's helpful for something
like a multi-monitor setup where you need to know which screen's app
currently has focus.