Closed zyrolasting closed 1 year ago
Currently it treats the entire racket-repl-mode
buffer as something to font-lock using mostly the same rules as a racket-mode
edit buffer.
Is this good or bad?
A REPL buffer is kind of a hopeless mix of:
print
in read-eval-print-loop
print
s and write
s in your end user program(display "I am not a Racket expression")
.Strictly speaking, only some of this stuff should be font-locked as Racket expressions or values.
Given this, you could argue that it's a mistake to font-lock the buffer, at all. Eventually it will produce a surprising or bad result. It can also be slow when the program prints many, large values.
You could argue it should be disabled by default, and advise users they can use racket-repl-mode-hook
to enable font-lock-mode
if they want it.
On the other hand, in my own years of using it I've found the font-lock to be useful enough -- it helps me visually parse things -- to like it despite the occasional glitches.
So the status quo is it's enabled by default, and you can use racket-repl-mode-hook
disable font-lock-mode
.
So my personal opinion is that it's not really a bug, except maybe a documentation bug? But I'm open to discussion.
I think there's a potential feature, which you hinted at: Have the back end somehow distinguish which parts of current-output-port
come from print
vs. display
so the front end can font-lock those or not, as appropriate. And maybe add more "region distinctions" in the front end as necessary.
This feels like a lot of work (plus the risk of breaking things) for a not-huge benefit. At least that's my initial feeling.
It might make more sense to undertake this as part of the work to support a lang lexer mode (and I'll tag this issue with that, for now).
I don't think this is the same as #463.
I'm not sure if this is better called a bug or a feature request, because I don't know if
racket-mode
tries to organize buffer text into regions.