-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Theme does not load with emacs --daemon
#59
Comments
This fixed it for me. |
@gutigen, the problem with that is that it reloads Nord with every single new frame. I got some code together using the class system, but it's horribly ugly code. I think I need to try a new approach. |
To avoid the load-on-every-frame problem I whipped up a variant using (if (daemonp)
(cl-labels ((load-nord (frame)
(with-selected-frame frame
(load-theme 'nord t))
(remove-hook 'after-make-frame-functions #'load-nord)))
(add-hook 'after-make-frame-functions #'load-nord))
(load-theme 'nord t)) Note that this requires Update: |
Sorry again for the delay. There's another issue about the ANSI color definitions so maybe I'll check how to better implement these to avoid the named "bright" colors listed above in the error log. |
Sorry for the long absence, I've been busy again with my job and work on the official Nord Docs with the goal to finally have a single-source-of-truth for all of Nord's port projects. Anyway, I'd like to get some of the long-time queued issues of some port projects done, including this one. @somesoup emailed me and submitted #68, a fix for this daemon mode problem. @zvbuhl posted some ideas how to solve it using the definition of faces and @jaccarmac also proposed another way how to solve it. @slippycheeze offered help for some problems in #66 (comment) and maybe has some ideas and opinions to get this done too. I tried to reproduce the log posted in the initial post, but when I run
It also works fine running Emacs without the GUI ( Like I said I'm not a Emacs user and I have no experience with Lisp so I rely on community help. |
Thanks for circling back! My snippet is working well enough in practice for now, but I've noticed some irregularities and will work on a reproduction guide later this week. That warning is just noise: It has to do with the way Emacs was compiled, not the environment it is running in nor the config. |
I can recreate this issue. I am loading Emacs 26.1 using |
The way to solve this "correctly" is to define the faces with all the options, and let Emacs select the appropriate color given the properties of the current frame. That'll work correctly with daemon mode, as well as a mixture of graphical and tty instances. TL;DR is instead of defining variables like this:
You want to define faces like this:
Additionally, check in the document linked below the I'd also consider a match for 24-bit color without the terminal type being set, so people with 24-bit TTY stuff setup will be able to get the full color experience. Sorry not to have time to address this myself, and only give pointers. Life isn't kind, sometimes. References:
|
@slippycheeze Thanks, this helps a lot and looks like the way to go. Absolute no problem for the delayed response time. Unfortunately, I have the same problem that the day only has 24h and necessary real life tasks absorbing almost all of it 😒 Since this is a open source project, everyone is free to go for it and submit a PR if it should be merged into this project. As soon as I'm done with porting all documentation and assets of all Nord's port project to the new official website of Nord there is hopefully more time to work on all the issues and PRs waiting in the queue. |
Might look at PR'ing this. Are there guidelines for what the Nord colors are in smaller color spaces or should I just eyeball it for 24-bit and 16-color displays? |
The newest release made this a lot worse. Basically no colors seem to be available and @accarmac init.el addition fails to connect to the daemon completely, with no output. (emacs just briefly flashes and then quits). The daemon is running, but there is no way to connect to it. Edit: nvm, downgrading does not seem to work. I think I might have manually changed something to nord-theme.el to fix the problem at some point. At the moment however, emacs is completely unusable when using nord. |
@rien333 I just upgraded to 0.4.0 (20190616.1757) and it seems to work okay. Still loads as light-blue on white, but I’m able to load the theme manually once I’ve got an X frame open, and then proceed as normal. |
Fixed by using the code from PR #64 (that adds a proper 24-bit check) and the daemon solution provided by the "ghost account". When using the solution provided by @jaccarmac my emacsclient just doesn't connect, and I havent been able to get useful debug info from it. (I've seen emacs complain about btw, I'm using emacs-26.2. |
@rien333 Thanks for your feedback, this helps to decide which of the already four proposed solutions might work the best for latest and older versions 👍 |
@rien333 Are you using |
That variable is nil, according to emacs. I also don't alter it in my init.el, nor does setting it to As an aside, I'm using the kitty terminal emulator, with 24-bit support in emacs made available by a |
It needs to be set with a file-local variable as in my config (see top), otherwise Further information about |
Here’s an attempt not to rely on the setting at daemon-start time. It’s a mechanical translation, and it’s embarrassingly unabstracted, but … maybe it’s a start? |
@jaccarmac, the addition on top of the file did the trick, thank you for your assistance and the resources on lexical-binding; I wan't completely familiar with the subject yet. |
So... I'm having a bit of a different issue than most folks here. I'm running emacs off The theme works great in either terminal ( #!/bin/bash
if [ -z "$(pgrep emacs)" ]; then
systemctl --user restart emacs
sleep 10
fi
SOCKET=$(lsof -c emacs | grep $USER | grep server | grep STREAM | awk '{print $9}' | sort | uniq)
PARAMS="--socket-name=$SOCKET"
if [[ $TMUX || $SSH_CLIENT ]]
then
PARAMS+=" -t"
else
PARAMS+=" -c"
fi
exec /usr/bin/emacsclient $PARAMS $@ Note: I can "switch" the working one by manually calling |
It might be that I'm missing something important, but it seems to me as if you start emacs the same way I do. I can use the nord-theme fine in either an X frame or in my terminal, and my systemd unit file shows that I also start emacs with |
@rien333 thanks for your input! unfortunately that still didn't solve it for me... if it makes a difference, I'm running tmux inside terminator for the console. I've got the nord-theme set up for terminator and using |
I'm seeing the same behavior as you if I run tmux with However, if I use |
@rien333 thanks! yeah just figured that out... after a bit of googling I finally got it working following this post, with the difference that I went ahead and put I should add I didn't need the #64 patch, but I did need @jaccarmac's fix for the daemon. |
In order to fix "unable to load color x" errors when running Emacs in daemon-mode, the defined theme colors are now tested against the `display-color-cells` "display feature testing" function [1] to support 24-bit color terminals with a fallback to the `display-graphic-p` function. This is a first step to fix the problems described in GH-59. Related to GH-59
I've submitted and merged #88 (superseded #64 due to stale state and merge conflicts) as a first step to fix the problem(s) documented in this issue. Anyway, the next release version will include the changes from #88 and I'd really appreciate feeback if it's a step forwards better compatibility 😄 |
@arcticicestudio this is the first time I upgraded |
Can't speak to the issues folks were having in a TTY, but I still need my delayed-load hack for the theme to load under a daemon properly. |
In order to fix "unable to load color x" errors when running Emacs in daemon-mode, the defined theme colors are now tested against the `display-color-cells` "display feature testing" function [1] to support 24-bit color terminals with a fallback to the `display-graphic-p` function. This is a first step to fix the problems described in GH-59. Related to GH-59
EMACS version: 28.0.5 I encounter this issue and I have this as a fix: (defvar my:theme 'nord)
(defvar my:theme-window-loaded nil)
(defvar my:theme-terminal-loaded nil)
(if (daemonp)
(add-hook 'after-make-frame-functions(lambda (frame)
(select-frame frame)
(if (window-system frame)
(unless my:theme-window-loaded
(if my:theme-terminal-loaded
(enable-theme my:theme)
(load-theme my:theme t))
(setq my:theme-window-loaded t)
)
(unless my:theme-terminal-loaded
(if my:theme-window-loaded
(enable-theme my:theme)
(load-theme my:theme t))
(setq my:theme-terminal-loaded t)
)
)))
(progn
(load-theme my:theme t)
(if (display-graphic-p)
(setq my:theme-window-loaded t)
(setq my:theme-terminal-loaded t)))
) I forgot where I found that snippet but credits to the owner. It works pretty well when I open it in the GUI with Weird thing is that when I run Left side is terminal while right side is the GUI: |
Interesting. I don't really use terminal Emacs, but decided to see how my fix fared in the same situation. And it turns out that if I start a daemon and then open a terminal client before a graphical client, the graphical client doesn't load the correct colors. If a graphical client is opened before everything plays together nicely. |
@iamriel Thanks for your help 👍 I've also noticed the exact same behavior while trying to reproduce the problem and thought it was my fault and lack of experience/usage with Emacs, but it's "good" to see that this is not scoped to my system. I'll keep this on my list for things that requires manual testing when the faces for theme colors are implemented. |
Just to mention that the unoffical Nord theme in the Doom themes (https://github.com/hlissner/emacs-doom-themes/blob/master/themes/doom-nord-theme.el) doesn't suffer from this issue but that theme is not as polished as this offical one. I wonder if we could merge these two version; Doom themes seem to well-maintained. |
Hey, still seeing this on:
Is #59 (comment) still the way to go? |
If emacs is started with
emacs --daemon
, the nord theme will not properly load, but will instead display as grey-on-white; there are many messages like the following:I believe that this is because in daemon mode there is no terminal, and thus nothing to send the colour names to. I think that the fix is to use the color class system as documented in Defining Faces.
The text was updated successfully, but these errors were encountered: