NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.3k stars 13.54k forks source link

Emacs doesn't follow Xresources settings on nixos-unstable #28221

Open vyp opened 7 years ago

vyp commented 7 years ago

Issue description

After updating nixos-unstable (and rebooting), Emacs doesn't seem to follow my Xresources settings for turning off the toolbar, menubar etc. Other Xresources settings, such as for setting terminal colours and font do still work.

It doesn't seem like the nix expression for emacs has changed between the commits, so I'm a bit stumped. (I was on nixpkgs a7c8f5e before updating.)

A workaround would be to just disable these in the emacs init file itself (don't know how but pretty sure it's possible).

Steps to reproduce

  1. Install emacs and xrdb, e.g. in /etc/nixos/configuration.nix:
  environment.systemPackages = with pkgs; [
    emacs
    xorg.xrdb
  ];
  1. Create a file named xresources with the following contents:
emacs.cursorBlink:        off
emacs.menuBar:            off
emacs.toolBar:            off
emacs.verticalScrollBars: off
  1. In /etc/nixos/configuration.nix:
  services.xserver.enable = true;
  services.xserver.displayManager.sessionCommands = "xrdb ~/xresources";
  1. Start an X session and run the command emacs from a terminal, and observe that emacs starts, but the cursor blinks, the menu bar is visible, the toolbar is visible and vertical scroll bars are visible, despite all of these being turned off in the xresources file. šŸ˜ž

Technical details

vyp commented 7 years ago

So this is easy to do via init.el instead:

(blink-cursor-mode -1)
(menu-bar-mode -1)
(toggle-scroll-bar -1)
(tool-bar-mode -1)

I don't think I had any particular reason for disabling these in xresources instead of init.el in the first place, therefore I'll close this eventually if no one has any ideas. šŸ˜®

matthewbauer commented 7 years ago

The main advantage of the Xresources method is that Emacs will turn off those things before it even creates the frame, potentially giving faster startup.

A few debugging things to try:

$ xrdb -query

and in Emacs:

(x-get-resource "cursorBlink" "CursorBlink")
vyp commented 7 years ago

Oh yes I remember, thank you @matthewbauer.

xrdb -query gives:

emacs.cursorBlink:      off
emacs.menuBar:  off
emacs.toolBar:  off
emacs.verticalScrollBars:       off

(x-get-resource "cursorBlink" "CursorBlink") returns nil.

vyp commented 7 years ago

On second thought, I don't think I'll close this just yet, just because I feel like this might be an artifact of another underlying bug somewhere else or something, especially since I don't think the direct nix expression changed. So future debugging may involve seeing if there are other emacs x resources settings that are being set (if there are other settings, I haven't checked).

I'll close this though if I find that I cannot reproduce this anymore, or if multiple others say they cannot reproduce this (indicating it's most likely just something do to with my system in particular)... or if this issue becomes so old that everyone uses wayland now.

a-schaefers commented 5 years ago

This is a real problem that I too have run into. For example, If you build Emacs with:

myEmacs = (pkgs.emacs.override {withGTK3=false; withGTK2=false; withX=true;});

xrdb ~/.Xresources # will not apply settings to Emacs.

I have run into the same problem with other x-toolkit applications, like urxvt. I'm not sure the problem is with Emacs.

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
garrett-hopper commented 4 years ago

I've just run into this when switching to the emacsGcc version of emacs-overlay. I also had to update some stuff for my window manager since the WM_CLASS changed from emacs to WM_CLASS(STRING) = "-emacs-28-0-50-wrapped_", ".emacs-28.0.50-wrapped_". Could .Xresources loading be changed by emacs being wrapped somehow?

garrett-hopper commented 4 years ago

It looks like changing from emacs.$property to *.$property makes it work, so it does appear to be something to do with the name changing.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info