[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Buffer-specific background color
From: |
Lennart Borgman |
Subject: |
Re: Buffer-specific background color |
Date: |
Mon, 21 Dec 2009 00:39:47 +0100 |
On Sun, Dec 20, 2009 at 10:39 PM, Colin Williams <lackita@gmail.com> wrote:
> I want to set the background color for a specific buffer, but I can't get it
> to work quite right. I am able to alter the color of the background for the
> face default using (face-remap-add-relative 'default :background "#F9F9F9"),
> but if the text ends before the end of the buffer, so does the differing
> color. By contrast, (set-face-attribute 'default (selected-frame)
> :background "#F9F9F9") will set the color for the whole buffer, but every
> other buffer in the frame as well. Is there a way to set the entire
> background of just the current buffer?
Unfortunately there is no way to change the background color for a
buffer. I hope this will be added to Emacs soon.
In the meantime perhaps the simplest workaround is to use an overlay.
This has several disadvantages though:
- It overrides face backgrounds (since yet you can't have an overlay
with a priority lower than 0. I have asked for this to be changed in
Emacs too).
- It does not extend to the bottom of the window.
However this workaround is implemented in the function
buffer-bg-set-color in buffer-bg.el (part of nXhtml).