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

From: Paul Pogonyshev <[email-masked]>
Date: Thu, 12 Jun 2008 23:20:04 +0300

Hi,

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>.  With an almost a year old build at
home, I don't see this bug, so it is a regression in Emacs.

It seems that HTML/XML mode uses two different ways to find syntactic
context for indenting code and for syntax-highlighting it, which I
find bad.  In some larger files I managed to get half a file highlighted
(wrongly!) with `font-lock-string-face', yet code indenting worked
just fine.  So, the same piece of code is considered an attribute value
by highlighting code, but normal tag tree by code indenting code.

Also, the bug seems to be heavily dependent on JIT highlighting.  E.g.
if you remove and then reinsert some of the characters which Emacs
considers parens, code is then rehighlighted correctly.

[originally posted to [email-masked], with attachment instead of
 inlined HTML]

Bug in:

<html>
<head>
  <script>
    function x () { return 1 > 0; }
  </script>
</head>
<body class="foo">
</body>
</html>

Paul