Brian Mastenbrook wrote:
To solve the problem of editing unbalanced strings or multiline comments, Andreas Fuchs suggested that it be possible to revert the syntactic type of an entire region when the insertion of an unmatched opening element would otherwise destroy this information. I think this is a good idea. It can be implemented by "hiding" one set of markers when the unmatched opening element is inserted, and un-hiding them after. Any edits the user makes in the meantime can be rectified to both the hidden and unhidden syntactic markers, thus meaning zero reparsing when the close element is inserted. However, this sounds like just the type of SMOP that is far more difficult than it sounds.
I'm curious to know what other people think about this. It seems to me that this is a rather difficult problem when the various nooks and crannies of CL syntax are taken into account (unless you're willing to live with the possibility of reparsing the entire source file on many edits). If this doesn't make any sense at all I'd like to know that too.
This makes sense to me, mostly because I'm willing to accept solutions that don't always work. If things look terribly wrong after the user is done with the editing, there's always (or should be) something like "M-x-reparse-the-darn-file" to fix things.
(Along these lines, I'm also assuming that you're limiting any real-time reparsing and recoloring to the region between the top-level (fsvo "top-level") markers that contains the editing point. There's also the obvious question of which markers should be "hidden" for display purposes and which should be "visible" -- it might be nice in some situations/modes for the displayed version to be based on the assumption that there's a closing element right after the insertion point.)
paul