syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.67k stars 4.89k forks source link

Spacemacs does not highlight trailing whitespace when started in daemon mode #14329

Closed marienz closed 2 years ago

marienz commented 3 years ago

Description :octocat:

Spacemacs does not highlight trailing whitespace when started in daemon mode

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart: Trailing whitespace is not highlighted

Expected behaviour: :heart: :smile: Trailing whitespace is highlighted, like it is without --fg-daemon

System Info :computer:

Details

It looks like the problem is how Spacemacs overrides the background color of the trailing-whitespace face in spacemacs-defaults/init-whitespace to be the font-lock-comment-face foreground color. When I start Emacs with --fg-daemon, :background for trailing-whitespace ends up nil. I think that happens because the code runs too early, before Emacs has a frame that supports colors: face-attribute is getting the value for the current frame, which is probably nil if that frame doesn't support colors.

If I remove that bit of code from Spacemacs, trailing-whitespace works correctly.

In addition to not working with --fg-daemon, Spacemacs overrides my custom theme here, which I'd prefer it didn't (if this is fixed I may still try to override Spacemacs's override). Maybe it's sufficient to change trailing-whitespace only in Spacemacs' default theme, allowing other themes to customize it as they see fit?

dalanicolai commented 3 years ago

Have you restarted the server after setting dotspacemacs-show-trailing-whitespace to t? I can not reproduce this (i.e. works fine here)

marienz commented 3 years ago

Gah, I likely screwed something up when I was testing this before.

After some more testing: I'm getting a different trailing-whitespace face in frames after the first one. That is:

Only the first frame works, the subsequent ones are bad.

I see the same thing if I don't close the original frame, just create a second one with SPC F n. That is: switching between the two frames and running SPC h d F trailing-whitespace RET produces different results depending on the frame I run it in. It's still good if I run it in the original frame.

I don't see the same problem if I start Emacs without --fg-daemon and create multiple frames (I also see a different background color, but that's possibly an unrelated bug).

I assume I screwed up my troubleshooting, but can't entirely rule out there's some other factor at work here I've missed. I did try this a few times and it seems to be reproducible (but I thought it was before, so yeah).

Can you (or someone else) see if they can reproduce it now? I'm happy to do some more troubleshooting on my end but it'd be useful to know if others can now reproduce. If not, I either still haven't found the actual trigger or it's something in my config (which I can bisect, but if it's reproducible for others I don't have to).

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!