Thanks. `post-command-hook` works better than `window-configuration-change-hook`. -Steven On Wed, Apr 3, 2013 at 8:11 AM, Michael Heerdegen wrote: > Óscar Fuentes writes: > > > Steven Degutis writes: > > > > > (defun auto-dim-other-windows () > > > (make-face 'sd/dimmed-font) > > > (set-face-attribute 'sd/dimmed-font nil :background "black") > > > > > > (defun sd/prominantize-current-buffer (fn) > > > (buffer-face-set 'sd/dimmed-font) > > > (funcall fn) > > > (buffer-face-set nil)) > > > > > > (defmacro sd/advise-window-changing-fn (fn) > > > `(defadvice ,fn (around window-changing-fn-advice activate) > > > (sd/prominantize-current-buffer (lambda () ad-do-it)))) > > > > > > (sd/advise-window-changing-fn other-window) > > > (sd/advise-window-changing-fn other-frame) > > > (sd/advise-window-changing-fn next-buffer) > > > (sd/advise-window-changing-fn previous-buffer) > > > (sd/advise-window-changing-fn quit-window) > > > (sd/advise-window-changing-fn mouse-select-window)) > > > > Interesting idea. > > > > Some observations (in case you already are interested on bugs & > > enhancements): > > > > Newly created windows doesn't show the effect (to replicate just do M-x > > 2). It is necessary to have different buffers on each window and move > > the cursor form one to another one time to trigger the background > > change. > > One could use `window-configuration-change-hook' for that. > > In general, I don't think it's a good idea to advice Emacs primitives > for that purpose. And probably it will be hard to find all necessary > functions to advice. What if the user has defined own commands to > select windows? Or uses other packages that do so, e.g. winner? > That's why I suggested using `post-command-hook' instead. > > > Regards, > > Michael. > >