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.

I want to make SQL interactive buffers that are connected to production DBs very, very obvious, so my thought was to change the background of the buffer to a dark red colour. set-background-color doesn't work, though; it sets the colour of all frames to the specified colour.

How can I change the background of just a single buffer?

share|improve this question
add comment

3 Answers 3

up vote 6 down vote accepted

I've created a emacs lisp package for this: https://github.com/vic/color-theme-buffer-local it uses Emacs' Face remapping to install theme faces locally.


(require 'color-theme-buffer-local)
(add-hook 'java-mode-hook (lambda nil (color-theme-buffer-local 'color-theme-robin-hood (current-buffer)) ))

share|improve this answer
add comment

You can't.

The background color is generally frame-specific.

You can set the background color of the default face to be frame specific using set-face-background, like so:

(set-face-background 'default "#CCCCCC" (window-frame (frame-selected-window))

Frame customizations are generally controlled through frame parameters. Now, if you look closely at the background-color for frame parameters, you'll see that the default background color is taken from the default face - which is why the above elisp has an effect.

Past that, it seems the closes you can come to a buffer background color is by using the minor-mode buffer-face-mode (added in 23.1) - however that only changes the background for the text of a buffer, and not the entire background.

share|improve this answer
add comment

I didn't try it, but http://www.emacswiki.org/emacs/BufferBackgroundColor sounds like a possible solution.

share|improve this answer
    
Nice idea, but it uses overlays, so it only changes the background of text. –  Chris R Jun 21 '10 at 6:39
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.