# The background color can't fill the buffer completely

I used a theme in emacs 24, but recently, the background color just filled area where characters are instead of the buffer completely. Even though I killed the orignal ~/.emacs, and used command like customize-* to change the theme to another one, it's not improved.

Later, I added "Emacs.background:#303030" to ~/.Xdefaults and start it with "emacs -Q" to try to solve the problem, but it didn't work.

Version Info:

• GNU Emacs 24.3.1

• gtk 3.10.8~8+qiana

• Distro: Linux Mint 17.1

@JordonBiondo provided the answer. Here are some alternative, related ways to do the same thing:

• Customize face default, to set its foreground to that color.

• Customize option default-frame-alist, to set its background-color to that color.

These all do the same thing. Face default correponds to the default settings for frame parameters foreground-color and background-color.

Using Customize has the advantage that it type-checks things, preventing simple typo mistakes and other, more important mistakes. And more generally (not in this case, however), it manages things like initialization and updating triggers.

Using simple assignment code in your init file does not handle these things (but it is often sufficient).

If you do use Customize (which you can do interactively, with the Customize UI, or from your init file, using customize-set-variable etc.) then I recommend that you define option custom-file, so Customize uses a separate file and doesn't mess with your init file. Just load custom-file from your init file.

• thank you both. However, after I tried the 3 way, and restart the Xorg, they're not work. The ~/.emacs file is here: imgur.com/q4VwgfI.png. #303030 isn't light gray. – Tan Kian-teng Jun 20 '15 at 16:01
• (1) There is no need to do more than one of the 3 (but that shouldn't hurt). (2) Did you get rid of the setting in .Xdefaults (if not, do so)? (3) What happens when you do not use any theme? That's the first thing to try - get rid of the theme and see if that works, at least. – Drew Jun 20 '15 at 16:32
• I've removed the ~/.Xdefaults, and disabled loading any themes, and the result is:imgur.com/fZnojNp (left: load ~/.emacs without loading any theme; right: emacs -Q) – Tan Kian-teng Jun 21 '15 at 0:26
• A recipe is best, starting from emacs -Q. Say exactly what you did. You should try one of the 3 things we have mentioned. Jordon's answer is a good place to start: emacs -Q followed by M-: (set-face-background 'default "#303030"). If that doesn't fix the problem, try M-x customize-face RET default RET, show all attributes, and tell us what you see. And put the cursor on some text (which has the background you set, apparently, use C-u C-x = there, and tell us if it says anything about a face (near the bottom). And put it at the end of a line, C-u C-x =, and tell us what it says. – Drew Jun 21 '15 at 3:26
• the record of command queue is there: hackpad.com/emacs-example-vRAUa9GiboF – Tan Kian-teng Jun 23 '15 at 3:37

You should remove your .Xdefaults settings for emacs and just put this in your init

(set-face-background 'default "#303030")


In my case I must have had a typo in my .emacs file, so opening the custom themes menu and reselecting my theme fixed the weird background for me. Same logic as the accepted answer.