By default, the background of text field is not correct set.
It looks like this

I can see Unable to load color "unspecified-bg" [24 times] in Message buffer.
Reload the theme manually would fix this.
But this may not be the only issue with emacsclient.
Go to a file would not enable lsp
File local-variables error: (doom-hook-error lsp! (void-function lsp-register-client))
Not sure if it's the same cause. I configured a new lsp client in config file.
(LSP is another issue with loading order, I think)
I can reproduce this in a fresh install. I always use SPC q Q to kill the daemon.
With /usr/local/bin/emacs everything works perfect.
No discrepancies with text background here but I've got another issue when launching Emacs through emacsclient i.e. with something like emacsclient -a '' -c -n. My issue is that cursor color is white and unchanging when I switch states, seems like doom theme is not properly initialized. So I used to have a timer in my config.el which reloads the theme:
;; fix doom theme cursor
(run-at-time "2 sec" nil #'doom/reload-theme)
Then I saw this issue and tried removing the above and launching Emacs through /usr/bin/emacs and guess what -- no issues!
Using a timer didn't look right so I've changed the above with a hook after frame is created:
;; fix theme when frame created by emacsclient
(add-hook! 'after-make-frame-functions
(defun my-load-theme-fix (frame)
(select-frame frame)
(doom/reload-theme)))
I have the same issue, and @zhelezov 's fix worked. However, I imagine this issue is also related to why (add-hook 'window-setup-hook #'toggle-frame-maximized) does not work when emacs is run as a daemon
@phillc
Why not use default-frame-alist for frame settings? Try this in the beginning of your init.el to default to maximized Emacs frames:
(add-to-list 'default-frame-alist '(fullscreen . maximized))
@zhelezov That worked, thanks!
@hlissner
@zhelezov's solution fixes the theme issue perfectly. Should we port that into doom or there would be a more straight forward fix?
I don't need any workarounds after 17174e1. What about the rest of you? If it works for you too, time to close this I guess.
Fixed the issue for me. Thank you all.
Most helpful comment
No discrepancies with text background here but I've got another issue when launching Emacs through emacsclient i.e. with something like
emacsclient -a '' -c -n. My issue is that cursor color is white and unchanging when I switch states, seems like doom theme is not properly initialized. So I used to have a timer in myconfig.elwhich reloads the theme:Then I saw this issue and tried removing the above and launching Emacs through
/usr/bin/emacsand guess what -- no issues!Edit
Using a timer didn't look right so I've changed the above with a hook after frame is created: