Emacs, as far as I remember, must load the .Xresources file on startup and read the font rendering settings from there. But mine does this only if I run xrdb merge first and then start emacs. I think I have something misconfigured here.

As my emacs starts as a systemd service I've just added ExecStartPre=xrdb -merge ~/.Xresources in the emacs.service. It practically solves the issue. But I still want to know why it's not working as it shouldbe?

Also, my .Xdefaults is a symlink to .Xresources and I use KDE on openSUSE.


It is working exactly the way it should. ~/.Xresources is conventionally loaded when you log in. Many distributions do this as part of the X session startup scripts. If you don't use a full destkop environment, you may need to add it to your login scripts, which would be systemd in your case, just like you did. The resources from ~/.Xresources are loaded into the X server and apply to all programs that display on that X server.

You may be confusing .Xresources with ~/.Xdefaults, which is loaded by each X client application when it starts, and then applies to this application. When using X remotely, the ~/.Xresources file is on the X server side, whereas the ~/.Xdefaults file is on the client side.

Note that Emacs only loads ~/.Xdefaults if no resources are loaded in the server (more precisely, if XResourceManagerString returns NULL). It also loads ~/.Xdefaults-$HOSTNAME unconditionally. I don't know why.

  • thank you for your answer. I've updated my question, can you comment on that? – contemplator Jul 24 '15 at 19:16
  • @contemplator Emacs doesn't load .Xdefaults if some resources are loaded in the server. I don't know why. – Gilles Jul 26 '15 at 0:18
  • How can I check that (are some resources loaded)? It is indeed works with ~/.Xdefaults-$HOSTNAME, nice workaround. – contemplator Jul 26 '15 at 19:01
  • @contemplator Run xrdb -query. I think if it produces no output, Emacs reads .Xdefaults. I'm not completely sure because I don't know when XResourceManagerString might return an empty string rather than NULL. – Gilles Jul 26 '15 at 20:14
  • There is a rather long list of settings in the output. I think most of them are default opensuse ones. My settings mixed in there, but one option, for which I care most, differs from my config. Is it possible to know where it came from? – contemplator Jul 26 '15 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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