Open cg505 opened 6 years ago
In daemon mode, there may not be a frame when you load your theme. You should add a hook to ‘after-make-frame-functions (or ‘after-init-hook). If you google you’ll find plenty of discussion regarding this.
On Apr 28, 2018, at 6:57 PM, Christopher Cooper notifications@github.com wrote:
When emacs is started in daemon mode (using emacsclient --alternate-editor= -c or emacs --daemon && emacsclient -c) the theme is not loaded correctly.
Expected result (just run emacs):
Actual result (emacsclient --alternate-editor= -c):
The most obvious difference is in background color.
This was tested in a totally clean .emacs, so I'm confident it's either an issue with emacs or emacs-material-theme. I'm glad to help in any capacity to track down the issue.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Sorry, I should have specified in the initial issue that those approaches do not resolve the issue.
Specifically, I tested:
(add-hook 'after-make-frame-functions
(lambda (_f) (load-theme 'material t)))
and
(add-hook 'after-init-hook
(lambda () (load-theme 'material t)))
Basically, (selected-frame)
doesn't correspond to the correct frame even if you run it in after-init-hook
or after-make-frame-functions
. A demonstrative example:
(add-hook 'after-make-frame-functions
(lambda (frame)
(message "selected: %s %s"
(terminal-name (frame-terminal))
(display-color-cells (selected-frame)))
(message "passed: %s, %s"
(terminal-name (frame-terminal frame))
(display-color-cells frame))))
result:
selected: initial_terminal 0
passed: :0, 16777216
The following DOES work:
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(load-theme 'material t))))
When emacs is started in daemon mode (using
emacsclient --alternate-editor= -c
oremacs --daemon && emacsclient -c
) the theme is not loaded correctly.Expected result (just run![correct](https://user-images.githubusercontent.com/1581504/39401869-147b8aa6-4b1e-11e8-91b0-7b544006dadd.png)
emacs
):Actual result (![wrong](https://user-images.githubusercontent.com/1581504/39401874-227fefd4-4b1e-11e8-83a5-217953a2f713.png)
emacsclient --alternate-editor= -c
):The most obvious difference is in background color. Reloading the theme fixes the issue, but disabling and re-enabling the theme does not.
This was tested in a totally clean .emacs, so I'm confident it's either an issue with emacs or emacs-material-theme. I'm glad to help in any capacity to track down the issue.