* bug#401: bug in HTML or XML syntax highlighting code
@ 2008-06-12 20:20 Paul Pogonyshev
2008-06-14 19:46 ` Stefan Monnier
2017-05-21 16:14 ` bug#401: fixed by mhtml-mode Tom Tromey
0 siblings, 2 replies; 4+ messages in thread
From: Paul Pogonyshev @ 2008-06-12 20:20 UTC (permalink / raw)
To: bug-gnu-emacs
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 emacs-devel@gnu.org, with attachment instead of
inlined HTML]
Bug in:
<html>
<head>
<script>
function x () { return 1 > 0; }
</script>
</head>
<body class="foo">
</body>
</html>
Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#401: bug in HTML or XML syntax highlighting code
2008-06-12 20:20 bug#401: bug in HTML or XML syntax highlighting code Paul Pogonyshev
@ 2008-06-14 19:46 ` Stefan Monnier
2008-06-14 20:19 ` Lennart Borgman (gmail)
2017-05-21 16:14 ` bug#401: fixed by mhtml-mode Tom Tromey
1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2008-06-14 19:46 UTC (permalink / raw)
To: Paul Pogonyshev; +Cc: bug-gnu-emacs, 401
> 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.
> 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. The indentation code usually can work much more locally, so
it tends to be more resilient.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#401: bug in HTML or XML syntax highlighting code
2008-06-14 19:46 ` Stefan Monnier
@ 2008-06-14 20:19 ` Lennart Borgman (gmail)
0 siblings, 0 replies; 4+ messages in thread
From: Lennart Borgman (gmail) @ 2008-06-14 20:19 UTC (permalink / raw)
To: Stefan Monnier, 401; +Cc: bug-gnu-emacs, Paul Pogonyshev
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#401: fixed by mhtml-mode
2008-06-12 20:20 bug#401: bug in HTML or XML syntax highlighting code Paul Pogonyshev
2008-06-14 19:46 ` Stefan Monnier
@ 2017-05-21 16:14 ` Tom Tromey
1 sibling, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2017-05-21 16:14 UTC (permalink / raw)
To: 401-done
I tried this test case using mhtml-mode, and it works fine there.
Because mhtml is the default now for HTML files, I think this bug has
been fixed.
thanks,
Tom
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-21 16:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-12 20:20 bug#401: bug in HTML or XML syntax highlighting code Paul Pogonyshev
2008-06-14 19:46 ` Stefan Monnier
2008-06-14 20:19 ` Lennart Borgman (gmail)
2017-05-21 16:14 ` bug#401: fixed by mhtml-mode Tom Tromey
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).