GNU bug report logs - #3269
23.0.93; C-mode text highlighting

Previous Next

Packages: cc-mode, emacs;

Reported by: Thomas Christensen <thomasc <at> thomaschristensen.org>

Date: Wed, 13 May 2009 07:20:03 UTC

Severity: normal

Done: Glenn Morris <rgm+emacsbugs <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Thomas Christensen <thomasc <at> thomaschristensen.org>,
        3269 <at> debbugs.gnu.org
Cc: emacs-pretest-bug <at> gnu.org
Subject: bug#3269: 23.0.93; C-mode text highlighting
Date: Thu, 14 May 2009 21:39:24 +0000
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).




This bug report was last modified 15 years and 179 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.