Subject: Re: bug#401: bug in HTML or XML syntax highlighting code

From: "Lennart Borgman (gmail)" <[email-masked]>
Date: Sat, 14 Jun 2008 22:19:15 +0200

Stefan Monnier wrote:
>> With fairly recent SVN build of Emacs I have the pasted below HTML code
>> highlighted wrongly.  Namely, "foo" is not highlighted as an attribute
>> value, apparently because there are non-corresponding (from Emacs point
>> of view) parentheses in <script>.
> 
> Indeed, part of the problem is that we use sgml-mode for this, even
> though your file doesn't seem like a properly formed SGML file.  We need
> to add special support for <script>.  Note that we do not properly
> support SGML either, e.g. if you use a CDATA[[...]] construct you'll
> bump into the same kinds of problems.

Does not nxml-mode handle this better?

>> It seems that HTML/XML mode uses two different ways to find syntactic
>> context for indenting code and for syntax-highlighting it, which I
> 
> Most/all major modes do.  The syntax-highlighting is done "globally"
> (especially the comment-vs-string-vs-code distinction), so it can get
> seriously messed up over the whole buffer in case the buffer's syntax is
> incorrect or is using constructs which the major mode doesn't
> understand.

I believe the cure to this is some multi major mode handling.