help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: c-mode conundrum


From: Alan Mackenzie
Subject: Re: c-mode conundrum
Date: Thu, 22 Jul 2004 20:04:13 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

J Krugman <jkrugman345@yahbitoo.com> wrote on Fri, 16 Jul 2004 23:26:35
+0000 (UTC):



> In my Emacs (v. 21.2, CC mode version 5.28), the following gets a
> screwy fontification (the last line gets colored as if it were a
> double-quoted string):

> /* -*- mode: C -*- */
> /*
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> ()'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> */

> void foo(int bar);


> The bizarre multiline comment is pretty much necessary.  Practically
> any alteration to it will cause the fontification to correct itself.
> Does anyone else experience the same problem?  If so, what could
> be the reason?

It's something to do with the parenthesis in column 0.  Some piece of
lisp, (probably c-guess-basic-syntax) is scanning text backwards, and on
finding the opening paren in column 0, jumps for joy, shouts "Eureka!
I've found the beginning of a defun!", totally oblivious to the fact that
it's within a comment.
 
> Is there a workaround?  (Looking for a workaround for this particular
> example would be silly, of course, but the example is a distillation of
> a real world situation.)

There's CC Mode 5.30.8 (the latest released version), to be found at
<http://cc-mode.sourceforge.net/release.php>, which does the font locking
considerably better, though it's not perfect :-(.  Note that between
versions 5.28 and 5.30, CC Mode's font locking was incorporated into CC
Mode itself, getting completely rewritten in the process.

Even the CVS head doesn't handle this case correctly, so many thanks for
the bug report!  :-)

I'd recommend 5.30.8 for now.  Hopefully 5.30.8 will be finding it's way
into the next release of Emacs.

> TIA,

> jill

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").



reply via email to

[Prev in Thread] Current Thread [Next in Thread]