nashamri / spacemacs-theme

Light and dark theme for spacemacs that supports GUI and terminal
GNU General Public License v3.0
601 stars 113 forks source link

Does not support multiple frames opened in both GUI and terminal #78

Open lingnand opened 7 years ago

lingnand commented 7 years ago

I run emacs daemon and have all my emacs frames connect to the daemon via emacsclient. As I understand the theme right now detects GUI/terminal env on theme loading during emacs startup - meaning that once the emacs daemon is up and running, if it is started within the GUI env, all the terminal (tty) frames that later connect to it will have wrong colors loaded - even though the theme itself does know what the colors should be for the tty.

I'm no expert on how to configure emacs to solve this problem - but a quick google shows that one should define the faces by specifying the display environment the faces are for explicitly: https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Faces.html

nashamri commented 7 years ago

Hey @lynnard thanks for reporting this :smile:

Can you provide some screenshots and some info about your setup? (OS, terminal emulator, etc...)

I see some issues when I used a tty and a gui at the same time but I need to make sure it's the theme's fault and not some weird issue with the terminal emulator.

Defining faces, I think, is out side the scope of the theme as they are usually defined by the modes.

lingnand commented 7 years ago

This is what it looks like when I have an emacsclient -nw in terminal connecting to an existing daemon started in GUI mode.

image

This is when I start a fresh -nw emacs instance in the same terminal.

image

Regarding faces - I got the hint here https://emacs.stackexchange.com/questions/2096/different-themes-for-terminal-and-graphical-frames-when-using-emacs-daemon - in the solution it does look like defining a theme though.

nashamri commented 7 years ago

Yeah I'm getting the same dark blue lines in your first screenshot and it seems like an issue with the theme. Thanks for the link, I'll look into it :+1:

nashamri commented 7 years ago

@lynnard this one seems a bit complicated :smile: As a workaround, from the emacs stackexchang link, this package https://github.com/vic/color-theme-buffer-local might be useful and should allow you to set a theme per buffer. I did not test it though.

lingnand commented 7 years ago

I tried it out but unfortunately it doesn't seem to support spacemacs-theme - it pops out a list of colorschemes after I trigger color-theme-buffer-local function but spacemacs-* is not within that list.

The other thing I realized while I was trying it out - even if it worked it wouldn't be a solution for the problem here as the plugin is for applying the theme on a buffer basis - which means the emacs frame in the terminal vs GUI would have to use completely different buffers; otherwise upon visiting the same buffer it would break in one or the other.

The point for using a terminal frame connected to the daemon is to use the same buffers though - so it would still be ideal if the same theme supports both environments natively.

Nasser Alshammari writes:

@lynnard this one seems a bit complicated 😄 As a workaround, from the emacs stackexchang link, this package https:// github.com/vic/color-theme-buffer-local might be useful and should allow you to set a theme per buffer. I did not test it though.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.*

-- Lingnan Dai

MichaelStergianis commented 7 years ago

I am having a similar problem, a temporary solution (works as long as your daemon is running until it is closed) is to call

(load-theme 'spacemacs-dark)
(spaceline-compile)

The reason I call spaceline compile is because loading the theme seems to load some of the spaceline colours incorrectly.

gagbo commented 5 years ago

A solution for this would be to specify the 2 classes in the theme. That's what was done in srcery-theme, and what I eventually did for my personal theme which follows more closely your architecture. It makes the code a lot more verbose but I don't have the issue anymore

nashamri commented 5 years ago

Could this be related? https://github.com/nashamri/spacemacs-theme/pull/144. I think some of the loading issues for the theme are solved by this.

gagbo commented 5 years ago

It is probably related, I removed the "dyn-let" before too, and I still had to reload the theme to have the changes appear properly between term and GUI. I have no need to reload anything with the 2 classes in the face definition