Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Related: How can I change the background colour of a single emacs buffer?

I would like to change the background color of the active buffer to, say, white. This sort of thing is possible as demonstrated by the linked question, but I am unsure how to go about hooking onto a change in the active buffer. How can this be done in a way that is robust whether I change with *-other-window or by clicking / mousing over?

share|improve this question
    
See also this related thread: stackoverflow.com/a/20936397/2112489 I've since updated / modified the code in my personal setup, but what is there is pretty close to what I currently use. I currently also change the color of the active mode-line depending upon the major or minor mode. –  lawlist Jul 23 at 14:31
    
@lawlist I discovered the active modeline group a little over a week ago---it's very helpful, but perhaps I'm just extremely unobservant :) –  Sean Allred Jul 23 at 14:43
1  
I don't think what I do is 100% robust but it works most of the time. I use defadvice on other-window, select-window, and select-frame, and I also use window-configuration-change-hook. Here's the code I use –  amitp Jul 24 at 21:09
    
@amitp is not robust, but I guess a good start. –  Dror Aug 6 at 12:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.