doomemacs / doomemacs

An Emacs framework for the stubborn martian hacker
MIT License
19.56k stars 3.06k forks source link

Theme differences in daemon vs standard GUI for the cursor column #6221

Open davidbudzynski opened 2 years ago

davidbudzynski commented 2 years ago

What did you expect to happen?

Both GUI and emacsclient should have the same color applied for the cursor column highlight, or cursor color in general. When using the doom solarized light and solarized dark high contrast (only tested these two), the cursor highlight color is inconsistent across both.

What actually happened?

Emacsclient version is light and has the incorrect color: image

Standard GUI version looks normal and has the correct color for the color scheme: image

Describe your attempts to resolve the issue

Running doom/reload-theme appears to fix the problem.

Steps to reproduce

  1. Set the theme to solarized (either light or dark high contrast)
  2. reload emacsclient
  3. open emacsclient GUI
  4. open standalone emacs GUI instance
  5. Compare the cursor column color or cursor color between the 2 windows

System Information

https://pastebin.com/198wTrk6

king-gheedorah commented 2 years ago

Same issue here, but my spacing is also broken. Notably, on the first load colors are correct. Afterwards, every following frame must run doom/reload-theme to correct the issue.

Tested with the doom-gruvbox and doom-one themes.

First frame: doom-gruvbox-proper

Every following frame: doom-gruvbox-test

king-gheedorah commented 2 years ago

I found a solution but am not sure how to integrate it into doom.

From a reddit post six years ago, so it appears to be a long-standing issue effecting theme load in the daemon: https://www.reddit.com/r/emacs/comments/3a5kim/emacsclient_does_not_respect_themefont_setting/cs9i9qd/

Adding this to my init.el solved the problem:

(defun load-doom-gruvbox-theme (frame)
  (select-frame frame)
  (load-theme 'doom-gruvbox t))

(if (daemonp)
    (add-hook 'after-make-frame-functions #'load-doom-gruvbox-theme)
  (load-theme 'doom-gruvbox t))
davidbudzynski commented 2 years ago

Thanks for sharing! Not sure if this is theming issue or Emacs issue then! This might be difficult for me to pull off because I can't decide on having one theme for more than a few weeks.

mangkoran commented 2 years ago

I also experienced this issue in Emacs 28.1 (with pgtk+native comp). @davidbudzynski I made a minor edit from @king-gheedorah code so that it will follow your currently set theme. Note that it uses doom-theme variable.

Edit: I put the following code in my config.el

-  (defun load-doom-gruvbox-theme (frame)
+  (defun load-doom-theme (frame)
     (select-frame frame)
-    (load-theme 'doom-gruvbox t))
+    (load-theme doom-theme t))

   (if (daemonp)
-    (add-hook 'after-make-frame-functions #'load-doom-gruvbox-theme)
-    (load-theme 'doom-gruvbox t))
+    (add-hook 'after-make-frame-functions #'load-doom-theme)
+    (load-theme doom-theme t))

As based on the Reddit post mentioned above, it is likely an upstream issue related with emacs daemon-client behavior on theming. I have not figure out whether the bug already filled out or not.

davidbudzynski commented 2 years ago

thanks, @mangkoran!

ronisbr commented 1 year ago

I am also seeing this problem with Emacs 29. The biggest issue is with light themes, because the cursor is usually not visible (white background and foreground).