-
Notifications
You must be signed in to change notification settings - Fork 52
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
Background color in emacsclient is incorrect #50
Comments
I have the same issue. I'm not doing anything special. (use-package atom-one-dark-theme
:demand t
:config
(progn
(load-theme 'atom-one-dark))) I have read that when you run emacs server, frame is not available until you attach an emacsclient. I've seen ppl recommending solutions like: (add-hook 'after-make-frame-functions
(lambda (_f) (load-theme 'atom-one-dark t))) However, the issue still persists and appears to not be related to frame. In the terminal, I am running the client+server like this: $ export TERM=xterm-256color
$ emacsclient --nw --alternate-editor='' This automatically starts the emacs server and attaches to it, but for some reason atom-one-dark's background is the same blue. Finally, I don't see this issue with other themes. Example: (load-theme 'tango-dark) Has the correct background in emacsclient. So I'm pretty sure this issue is with |
I found a workaround. Not pretty, but it does address the issue. (if (daemonp)
(add-hook 'after-make-frame-functions
(defun my/theme-init-daemon (frame)
(with-selected-frame frame
(load-theme 'atom-one-dark))
;; Run this hook only once.
(remove-hook 'after-make-frame-functions
#'my/theme-init-daemon)
(fmakunbound 'my/theme-init-daemon)))
(load-theme 'atom-one-dark)) It seems the issue is with frame availability at the time the theme is loaded. I wonder if, similar logic could be added to the theme to handle emacsclient use cases. |
@jclosure Huh; neat! I don't currently use this theme anymore, but that's good to know. Do you happen to know why it only seems to impact this theme? Or is that because it's the first theme loaded? |
It's because of this line:
When it runs, it's expecting either 24bit or 256 color. The var export TERM=xterm-256color What I needed to do was to instruct my terminal how to support 24bit, then everything looked perfect. #!/bin/bash
# adds a terminfo entry defining a new terminal xterm-24bit
# If you run emacs (26.1+) setting TERM=xterm-24bit, then it
# will use 24bit color
cd $(mktemp -d)
cat <<EOF > terminfo-24bit.src
# Use colon separators.
xterm-24bit|xterm with 24-bit direct color mode,
use=xterm-256color,
setb24=\E[48:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm,
setf24=\E[38:2:%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%dm,
# Use semicolon separators.
xterm-24bits|xterm with 24-bit direct color mode,
use=xterm-256color,
setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
EOF
tic -x -o ~/.terminfo terminfo-24bit.src
rm terminfo-24bit.src |
Context: I'm running Ubuntu in WSL on Windows 10. Using Emacs through the terminal (Fish, if it changes anything).
The problem:
When running
emacsclient
, the background is incorrectly colored blue rather than the correct background color, which in this case would be to use the terminal's background color. The issue only occurs when running that one command (it works fine if I start it withemacs
), and it does not seem to affect any other themes. I'm not really sure what is to blame here or whether it's on your end or mine, but considering it seems to only affect this theme, I thought I would raise this issue to at least see if you could offer any insights.Please see the attached images for details. I'd be happy to provide you with more info if you let me know what you need.
![one_dark](https://user-images.githubusercontent.com/17786332/48287215-6e1e2080-e468-11e8-90fc-3b7cec6314a2.png)
One dark run with the
emacs
commandOne dark run with the
![one_dark_emacsclient](https://user-images.githubusercontent.com/17786332/48287248-855d0e00-e468-11e8-847e-ba64d5ca1c02.png)
emacsclient
command. Background is solid blue.Tomorrow night theme run with the
![tomorrow_night_emacsclient](https://user-images.githubusercontent.com/17786332/48287276-9f96ec00-e468-11e8-971c-80ed15a625cd.png)
emacsclient
command. Background is transparent (same color as the terminal).EDIT:
This bit of code in my config file might be relevant, though I did try disabling it and restarting the server to no effect. It is run as a
'window-setup-hook
.The text was updated successfully, but these errors were encountered: