Emacs won't use XWindows

Greetings all.
Yesterday I got a new laptop with Manjaro + Plasma preinstalled. Today I installed emacs and it’s fine in console mode. But it refuses open a window whatever way I try to launch it.

emacs & or emacs -D & in konsole give me
Undefined color: “WINDOW_FOREGROUND”

and nothing shows up in KSystemLog. Everything is up to date.

Any idea?
Thanks, alcofribas

PS If this is not the right place for this query please tell me.

I have no idea on how to use emacs but one obvious test is to set the variable to some value.

I don’t know how emacs expect such setting - you could look in the emacs config or maybe .Xresources - it requires some searching on your own.

Setting foreground to white using escape

$ WINDOW_FOREGROUND=\e[41m; emacs -D &

Using hex

$ WINDOW_FOREGROUND=#fff; emacs &

Using color name

$ WINDOW_FOREGROUND=white; emacs &

Thanks you very much for the tip. I overcame my initial panic and went through the long list of command-line options in the emacs manual. When I do

$ emacs --no-x-resources &

I get a primitive looking UI but something that I can use. On the other hand, considering WINDOW_FOREGROUND as an environment variable always gets me that same error message.

So the problem seems to be either with X or GTK resources. There is long chapter in the manual about how these two are used in emacs, but their syntax is really different from that all-caps style.

I’ll experiment a bit more. Thanks again, alcofribas

And you did try an internet search?


Not yet! The first priority is getting the meta key on emacs to work the way I am used to. Getting nice icons takes a back seat. Quite a lot of key combinations are captured by Plasma… this deserves a righteous rant one day, but not on this polite, helpful and very responsive site.

I’ll keep you in touch.

OK, I got it after a little search. It’s a bug that’s mentioned in a 2017 Arch forum, and I got the following more detailed version in a 2014 Centos forum.

It’s a bug in both KDE (as shipped) and Mate (EPEL). They use X resources and expect them to be preprocessed (replacing WINDOW_FOREGROUND with some colour). But X resources are no longer preprocessed in Centos7. There are bugzilla entries for both but nothing happens. For KDE you can turn off something like “apply colour scheme to non-KDE apss” as a workaround. For Mate you can delete all X resources with “xrdb /dev/null” before you start emacs (or any other legacy program).

The proposed workaround was for KDE4 and doesn’t seem possible anymore, but the xrdb trick worked for me. I find it quite amazing that this bug is still around after all those years.

I also faced this problem. But after I installed a software like mpv-git( other softwares which have graphical interfaces maybe work I guess) from AUR, ran it and rebooted the system, this problem had been solved. Maybe the system dismisses something important.