[plt-scheme] drscheme syntax coloring in normal editing?

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sat Jun 28 00:58:58 EDT 2003

Making a separate thread work shouldn't be too difficult, esp thanks to
the new CML-like mzscheme primitives. They take lots of the pain out of
multi-threaded programming. If you've not programmed with threads much,
you will learn a lot :)

One way to organize the code is to create a separate thread that just
reads out of the text, building the correct table. This thread just
assumes that there is no modification going on in the text. Then, you
can override the on-insert/after-insert (and other on/after pairs) that
send messages to the thread. One will interrupt the thread and the
other will restart it (with some portion of the cache'd data cleared
out, based on the exact modification to the buffer).

If you combine that with some kind of regexp-based quick answer that
only works on a single line or a fixed number of characters, I think
you'll basically have what emacs does.

Anyways, if you want to talk more about that, I'd be glad to help.


PS: I've just had this feeling of deja vu -- have we talked about this

At Fri, 27 Jun 2003 21:13:33 -0600, Scott Owens wrote:
> My motivation isn't Scheme but ML and Java, so I'm most certainly going 
> for emacs-mode functionality and not check syntax functionality.  My 
> basic idea is to lex the buffer and incrementally update the tokens.  
> This will never be wrong, but the cost of inserting/deleting a string 
> or block comment delimiter could be very high.  I think a separate 
> thread would be the best solution, but I'm not sure how to implement 
> that in a safe way for the text%.  If that fails then limiting the work 
> to the next few/previous lines should be a workable solution.
> -Scott
> BTW, this project is made possible by the new editor modes.
> On Friday, June 27, 2003, at 07:14  PM, Robby Findler wrote:
> > At Fri, 27 Jun 2003 18:22:19 -0600, Scott Owens wrote:
> >> Actually, I hope to implement this in the next few weeks.
> >
> > Mind sharing some details of how it will work? Do you have a
> > replacement for the paren matcher? Do you use a background thread? Is
> > your algorithm ever wrong? How do you handle macros?
> >
> > Robby

Posted on the users mailing list.