gcv / julia-snail

An Emacs development environment for Julia
GNU General Public License v3.0
230 stars 21 forks source link

Colour scheme #11

Closed dahtah closed 4 years ago

dahtah commented 4 years ago

First of all, thanks for doing this, it's going to greatly improve my Julia-on-emacs experience I think. Perhaps more of a tip than an issue, but on spacemacs, I suppose due to the colour theme, errors appear gray-on-gray in the Julia REPL, i.e. you can't see them, which looks like a bug but isn't. This can be fixed for instance by setting

ENV["JULIA_ERROR_COLOR"] = :magenta

in startup.jl. Another option is to maybe change the default background colour in vterm?

gcv commented 4 years ago

It certainly sounds like a theme collision. Could you run list-faces-display and check all faces prefixed vterm-color-? By default, they should look as labeled (i.e., red is red, blue is blue, etc.). From the way you describe the problem, vterm-color-red is set incorrectly (since I expect the Julia REPL to use :red as the default error color). Maybe post a screenshot of this view?

Also, a note: if you don't want to change startup.jl and just affect the Emacs display of the REPL, you can put (setenv "JULIA_ERROR_COLOR" "magenta") in the :config section of your use-package invocation for julia-snail.

dahtah commented 4 years ago

Here's a snapshot (emac 26, spacemacs from dev branch): gray_on_gray_small

All faces prefixed by vterm- appear correct: vterm_small

Also, a note: if you don't want to change startup.jl and just affect the Emacs display of the REPL, you can put (setenv "JULIA_ERROR_COLOR" "magenta") in the :config section of your use-package invocation for julia-snail.

Very nice, thanks!

gcv commented 4 years ago

Let's try to track this down.

Use vterm-copy-mode (C-c C-t) to position the cursor on an invisible letter. Run describe-char. This should pop up a help buffer including a font-lock-face or some other kind of face property. Look at its values for :foreground and :background. Next, try to find where those values are used in the Spacemacs theme you're using. For example, when I use Zenburn, I get a foreground color of #8C5353. Then I look at zenburn-theme.el and track it down to a named color, zenburn-red-4. Then I look for use of that name, and find it used for term-color-red. And vterm.el inherits that in vterm-color-red.

Judging by your screenshot, something different happens somewhere in that chain of color configuration. It certainly seems that vterm-color-red is unused. Maybe it uses term-color-red directly? And that is itself misconfigured in the theme, or missing altogether (in which case it might be getting picked up from another theme or from a bad default)?

dahtah commented 4 years ago

It's rather mysterious. I'm using the default spacemacs theme ("spacemacs-dark"), but the problem also shows up under "spacemacs-light". The same colour (bg1) is used both in the foreground and background. term-color-red is present and indeed red.

gcv commented 4 years ago

I installed spacemacs-theme from MELPA in a sandboxed Emacs (i.e. one which runs without any other packages or custom configuration, just contains spacemacs-theme, julia-snail, and their dependencies). Everything looks fine to me:

Screen Shot 2020-03-25 at 14 22 18

Face properties on error strings are :foreground "#f2241f" :background "#292b2e", which show up as red and bg1 respectively. It's very strange that bg1 bleeds from the background to the foreground setting in your environment.

Since I don't use the Spacemacs distribution itself, it's not easy for me to test it standalone.

What does ENV["TERM"] (from a Julia REPL) return? Mine says xterm-256color. What about a separate vterm shell session, does it have the same problem? What is its TERM variable set to? Maybe it's a terminfo problem? Could you delete vterm completely, restart Emacs, and reinstall it and see if that makes it go away? What if you set JULIA_ERROR_COLOR to :red/"red" explicitly?

Grasping at straws here... Such a strange problem, but I'm sure you're not the only one who will run into it.

dahtah commented 4 years ago

OK, I think I've made some progress. The same problem appears when running Julia in vterm, and setting ENV["JULIA_ERROR_COLOR"] = :redfixes it. However, I've found out that by default julia uses not "red" but Base.error_color() which is :light_red. The vterm readme says that installing eterm-256-color improves colour handling on some systems, but in my case it makes things worse (julia goes mostly grayscale). I'm guessing that until colour handling on emacs-libvterm improves, it might be better to set ENV["JULIA_ERROR_COLOR"] = :red somewhere.

gcv commented 4 years ago

Fixed in c293f0d, please take a look.

dahtah commented 4 years ago

Fixed, thanks!