unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* c-mode conundrum
@ 2004-07-16 23:26 J Krugman
  2004-07-22 20:04 ` Alan Mackenzie
  0 siblings, 1 reply; 2+ messages in thread
From: J Krugman @ 2004-07-16 23:26 UTC (permalink / raw)





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?  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.)

TIA,

jill

-- 
To  s&e^n]d  me  m~a}i]l  r%e*m?o\v[e  bit from my a|d)d:r{e:s]s.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: c-mode conundrum
  2004-07-16 23:26 c-mode conundrum J Krugman
@ 2004-07-22 20:04 ` Alan Mackenzie
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Mackenzie @ 2004-07-22 20:04 UTC (permalink / raw)


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").

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-22 20:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-16 23:26 c-mode conundrum J Krugman
2004-07-22 20:04 ` Alan Mackenzie

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).