2

I am using Emacs 24.3.1 on Ubuntu 13.10 amd64, Xubuntu session running in GUI mode.

unwanted grey frame background

As you can see the frame background is grey. I want it to be white. The following all continue to result in a grey frame background:

  • emacs -bg white
  • (set-background-color "white")
  • (add-to-list 'default-frame-alist '(background-color . "white"))
  • (add-to-list 'initial-frame-alist '(background-color . "white"))
  • M-x set-background-color RET white

The screenshot shows doing M-x describe-face. All the variations are what I have found elsewhere in searching, but nothing works. (Yes I restart after changing .emacs and verify there are no errors. I don't have .Xdefaults/.Xresources.) Even picking a theme from Options > Customize Emacs > Custom Theme doesn't result in the frame background changing colour while everything else does.

itsjeyd
  • 5,070
  • 2
  • 30
  • 49
Roger Binns
  • 3,203
  • 1
  • 24
  • 33
  • 1
    Did you start from `emacs -Q`, to remove your init-file from the equation? If not, try it. If yes, then try bisecting your init file recursively to find the culprit code. Since the background of face `default` is "White", as shown, that is also the frame parameter `background-color` value, which should be what is shown outside the text areas. Does doing `C-l` make the gray go away? What happens if you do `C-x 5 2` -- does the new frame look the same? – Drew Nov 11 '13 at 05:23
  • Using -q (upper or lower case) with -bg white still gives the problem. With -Q -bg white http://imgur.com/Ta83Lri and with -q -bg white http://imgur.com/ajWerBl Making new frames, reducing back to one etc all make no difference. emacs is absolutely determined to have that grey background. – Roger Binns Nov 11 '13 at 06:40
  • Dunno what else you can look at *in Emacs*. Emacs is telling you that the frame background is white. Could the problem be that you are using Emacs through some other software -- e.g., a virtual desktop or something? This is beginning to sound to me like it is not an Emacs problem, but that's just a hunch. – Drew Nov 11 '13 at 14:59
  • No - this is a regular desktop (Xubuntu) session. My suspicion is a problem with the way emacs uses whatever toolkit it uses. Many other people have experienced the same problem, but one of the things I listed fixed it for them. – Roger Binns Nov 11 '13 at 17:41
  • Another possibility I can think of is that some code you use applies a `face` (or a `display`) text property or (overlay property) to newline characters in your buffer. But from the image it looks like there is a char-width of white at the end of each line. I assume that the lines do not end in whitespace, so perhaps your toolkit treats the newline char that way (and paints the space to the right of the newline gray, for some reaseon). If you do `C-e` and then `C-u C-x =`, does it tell us anything interesting? – Drew Nov 11 '13 at 18:42
  • http://imgur.com/I6IRu1R shows the result. Every line has a white backgrounded character for newline. If I do the C-u C-x = where there is a character, then the only difference in the results is display says "by this font (glyph code)" and a new line appears "xft:-unknown-DejaVu Sans Mono-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1 (#x5B)" – Roger Binns Nov 11 '13 at 20:11
  • OK, I'm no expert on this stuff. But I see the following: (a) there are 2 overlays on the newline character, which are from "semantic", (b) the newline char seems to have a decomposition property on it. You will need to get someone more knowledgable about those to help. But right away it shows that you did not provide a recipe starting from `emacs -Q`. You can start by bisecting your init file recursively (e.g. by commenting) until you find the code that is responsible for the pseudo gray background effect. After that, you can ask specifically about that culprit code. – Drew Nov 11 '13 at 21:16
  • My init file is not a problem since the problem occurs without it. *Nothing* I have ever done has ever resulted in a non-grey background so I can't bisect. You didn't ask for Cu-Cx= to be done from -Q which is why I didn't do it - I actually need emacs for work! Here it is from -Q http://imgur.com/eBuJTWi on the scratch buffer that appears. – Roger Binns Nov 12 '13 at 03:09
  • OK. The info in that screenshot is different. It simplifies things, since it removes Semantic from the equation. But I don't know the answer -- hopefully someone else will. There is still the `decomposition` property, which I'm not familiar with, but that appears for me too with `emacs -Q` (but it looks like a SPC char between quotes, whereas for you it shows a hollow rectangle between quotes. Probably this is insignificant. You can try clicking the `Customize what to show` link and choosing more things to show, but you'll need someone who can help or else consult the manual. Sorry. – Drew Nov 12 '13 at 03:57
  • You can also try sending a mail to `help-gnu-emacs@gnu.org`, if you get no help here. – Drew Nov 12 '13 at 03:58
  • (I assume you have no `Xresources` or `Xdefaults` that might affect this.) I'd also suggest googling, but you said that you searched already. Searching for `xubuntu emacs background gray` I see this -- dunno how similar or helpful it is (it seems to be console, not GUI): http://ubuntuforums.org/showthread.php?t=1081568. Good luck. – Drew Nov 12 '13 at 04:05
  • Googling was the first thing I did hence my list of collected "solutions" that didn't work. That link is for text not gui mode as you suspected (and why my question explicitly makes it clear I am using gui mode). – Roger Binns Nov 12 '13 at 04:09
  • @Roger Binns: It is interesting that you have the `font-lock-comment-face` property in the screenshot. I assume you have already tried to deactivate `font-lock-mode` via `M-x` `font-lock-mode`? (By the way: Hi Drew.:-)) – Tobias Nov 12 '13 at 07:17
  • @Roger Binns: I am quite sure that at home I have the same configuration (xubuntu 13.10 and emacs 24.3.1). (Not so sure about the last numbers. Currently, I am at work.) I do not have this problem with the background color of emacs. Maybe, we can compare some configuration stuff. I am not sure yet what exactly. Maybe, the first try would be an xinfo on the emacs window? – Tobias Nov 12 '13 at 09:17
  • I've found the cause. When using xubuntu gnome 3 apps look truly ugly. The documented fix everywhere is to symlink ~/.config/gtk-3.0 to /usr/share/themes/THEMENAME/gtk-3.0. I use Greybird as the theme in xubuntu settings and for that symlink. emacs obeys all that instead of the numerous other ways of setting background colour. Sadly the css to use to control emacs/gtk-3.0 isn't documented anywhere – Roger Binns Nov 12 '13 at 20:13

1 Answers1

2

When using XFCE or Xubuntu, Gnome 3 applications look ugly as they use no theming. The solution is to symlink $HOME/.config/gtk-3.0 to /usr/share/themes/THEMENAME/gtk-3.0 - see e.g. this thread on the XFCE forums.

If you do this then whatever is in that theme is what Emacs uses, with it completely ignoring all other attempts to set the background colour. In theory a rule can be added to the theme CSS like

.emacs { background-color: white;}

but the documentation is not sufficient to work out what to use.

As a hack, I now have a script to launch Emacs that moves $HOME/.config/gtk-3.0 out the way while Emacs starts:

#!/bin/bash

cd "$HOME/.config"
mv gtk-3.0 _gtk-3.0
emacs "$@" &
sleep 3
mv _gtk-3.0 gtk-3.0
itsjeyd
  • 5,070
  • 2
  • 30
  • 49
Roger Binns
  • 3,203
  • 1
  • 24
  • 33