Open kengruven opened 1 week ago
Interesting...
When I run e2ansi from inside a GUI emacs, it seems to work. I tried both the default number of colors, 256, and 16.
However, when I run e2ansi in batch mode, it doesn't appear to be working.
I dived into the racket-mode source code and found that it created a number of "faded" faces on the fly, by reading the foreground color of other faces.
Unfortunately, this will not work in a batch environment since faces in noninteractive mode doesn't have colors.
I don't have any good solution for you. The ones that I can think of is:
Instead of replicating and fading the current foreground of a face, it should do this for the full face definition. I.e. walk into each alternative definition. Unfortunately, it needs to replicate the entire inheritance tree, just in case the foreground is inherited. (In practice, I don't think this is a good alternative.)
Use face-explorer
to find the color it should have had, and fade that. (Face-explorer plays a what-if game, traversing all the face and theme definitions to figure out what it would have looked like, under certain circumstances.) (However, I don't think this is a good alternative either.)
Implement some kind of fallback in Racket-mode when in noninteractive mode, so that the faces can be manually defined.
Implement some kind of override in e2ansi, like a map from one face to to face attributes. That way you could define how you would like the faded Racket faces to look like.
Come to think of it. It might work (I haven't been able to test it) to define a color theme with the faces in question. I think color themes take precedence over the face basic definition.
Yeah, I suspected this was going to be complex. Feel free to close this bug. It's not that important to me.
In Racket programs, for sexp comments, racket-mode does a very clever thing: the code in the sexp comment is highlighted with colors as normal, but then also grayed out.
For example, with my theme, the line
(sqrt 4)
has the function name in orange, and the number in bright green. The line#;(sqrt 4)
has has the function name in dark orange, and the number in dark green. All the other characters are gray.Currently, e2ansi doesn't do this. Sexp comments are entirely plain gray, which is fine, but not quite the same.
The relevant part of racket-mode seems to be here. I don't know enough about font lock in Emacs (or e2ansi) to know if this would be easy or hard. It would be nice to have, but it's certainly not the most important feature.