bug#3269: 23.0.93; C-mode text highlighting

Alan Mackenzie <[email protected]>
Newsgroups gmane.emacs.bugs,gmane.emacs.pretest.bugs
Message-ID <[email protected]>
On Wed, May 13, 2009 at 08:39:47AM +0200, Thomas Christensen wrote:

> In c-mode type:
> #define FOO "\
> foo\n\
> bar\n\
> "

> Then place the cursor after foo\n\ and press RETURN for a new line.

> The highlighting is now broken, and I can only restore it by reverting
> the buffer.

That's a bit vague, so let me fill it out for you.  ;-)

When you press RETURN as described, the new line you've just made lacks a
backslash, hence terminates the macro.  (Yes, I know you knew that.)

    #define FOO "\
    foo\n\

    bar\n\
    "

The "foo" line has lost its fontification, and this is the bug.  I know
what's causing it, and it _might_ be easily fixable.  What's more, I
don't this bug was in Emacs 22, so Chong Yidong would allow it to be
fixed.  :-)

The "bar" line and what follows (which is no longer part of the macro)
is so remote from being valid C syntax that no compaint about its
fontification is reasonable.  

If you insert a backslash in the blank line, the bottom bit becomes
correctly fontified again.  The top bit needs you to type M-o M-o, as
Andreas said, to restore its colour.  This is because font lock, when
triggered by a buffer change, only refontifies the current line and those
below it.  This is a longstanding problem with font lock which is
difficult (though not impossible) to fix.

Thanks for taking the trouble to report this bug.

-- 
Alan Mackenzie (Nuremberg, Germany).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.