GNU bug report logs - #5422
syntax highlighting bug

Previous Next

Packages: cc-mode, emacs;

Reported by: blew <at> astro.uni.torun.pl

Date: Tue, 19 Jan 2010 13:18:01 UTC

Severity: normal

Tags: moreinfo

Done: Bartosz Lew <blew <at> doktorant.umk.pl>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5422 in the body.
You can then email your comments to 5422 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5422; Package emacs. (Tue, 19 Jan 2010 13:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to blew <at> astro.uni.torun.pl:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 19 Jan 2010 13:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bartosz Lew <blew <at> astro.uni.torun.pl>
To: bug-gnu-emacs <at> gnu.org
Subject: syntax highlighting bug
Date: Tue, 19 Jan 2010 13:21:30 +0100
Hi,

This is just to report on some minor C++ syntax highlighting problem in emacs.

when I write:

	if (a < b->c())  { do this; } else { do that; }

two two things go wrong:
1) parentheses matching doesn't work correctly 
	emacs matches the closing bracket of the if condition with the "<" - "smaller 
than" sign in the if condition.

2) the automatic positioning of any code written below gets confused due to 
this parentheses matching problem.

I use:

 GNU Emacs 23.1.1 (i386-redhat-linux-gnu, GTK+ Version 2.16.6)
 of 2009-09-29 on x86-7.fedora.phx.redhat.com

Hope this is of any use.
Cheers,
Bart








bug reassigned from package 'emacs' to 'emacs,cc-mode'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 19 Jan 2010 19:24:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#5422; Package emacs,cc-mode. (Mon, 03 Oct 2011 21:01:01 GMT) Full text and rfc822 format available.

Message #10 received at 5422 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: blew <at> astro.uni.torun.pl
Cc: 5422 <at> debbugs.gnu.org
Subject: Re: bug#5422: syntax highlighting bug
Date: Mon, 03 Oct 2011 16:59:17 -0400
Bartosz Lew wrote:

> This is just to report on some minor C++ syntax highlighting problem
> in emacs.
>
> when I write:
>
> 	if (a < b->c())  { do this; } else { do that; }
>
> two two things go wrong:
> 1) parentheses matching doesn't work correctly 
> 	emacs matches the closing bracket of the if condition with the
> "<" - "smaller > than" sign in the if condition.
>
> 2) the automatic positioning of any code written below gets confused due to 
> this parentheses matching problem.
>
> I use:
>
>  GNU Emacs 23.1.1 (i386-redhat-linux-gnu, GTK+ Version 2.16.6)
>  of 2009-09-29 on x86-7.fedora.phx.redhat.com

I am unable to reproduce this in any version of Emacs, including 23.1.
If you still see the problem in the latest release, please send a
complete example starting from emacs -Q.

(There seem to have been some fixes in this area, eg
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4847 )




Reply sent to blew <at> astro.uni.torun.pl:
You have taken responsibility. (Mon, 03 Oct 2011 21:30:02 GMT) Full text and rfc822 format available.

Notification sent to blew <at> astro.uni.torun.pl:
bug acknowledged by developer. (Mon, 03 Oct 2011 21:30:03 GMT) Full text and rfc822 format available.

Message #15 received at 5422-done <at> debbugs.gnu.org (full text, mbox):

From: Bartosz Lew <blew <at> doktorant.umk.pl>
To: Glenn Morris <rgm <at> gnu.org>
Subject: Re: bug#5422: syntax highlighting bug
Date: Mon, 3 Oct 2011 23:24:29 +0200
Thanks for the email.

Well, I don't see this behaviour now either but now I'm working 
on 
Emacs 23.2.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.4)
of 2011-05-23 on x86-12.phx2.fedoraproject.org
installed on a new computer.

I sent the bug report one laptop ago and that computer has crushed,
so I cannot easily go back to that configuration without system reinstall.

Anyway, everything seems fine with my current version.
Thanks again.
Bartek.

On Monday 03 of October 2011 22:59:17 you wrote:
> Bartosz Lew wrote:
> > This is just to report on some minor C++ syntax highlighting problem
> > in emacs.
> > 
> > when I write:
> > 	if (a < b->c())  { do this; } else { do that; }
> > 
> > two two things go wrong:
> > 1) parentheses matching doesn't work correctly
> > 
> > 	emacs matches the closing bracket of the if condition with the
> > 
> > "<" - "smaller > than" sign in the if condition.
> > 
> > 2) the automatic positioning of any code written below gets confused due
> > to this parentheses matching problem.
> > 
> > I use:
> >  GNU Emacs 23.1.1 (i386-redhat-linux-gnu, GTK+ Version 2.16.6)
> >  of 2009-09-29 on x86-7.fedora.phx.redhat.com
> 
> I am unable to reproduce this in any version of Emacs, including 23.1.
> If you still see the problem in the latest release, please send a
> complete example starting from emacs -Q.
> 
> (There seem to have been some fixes in this area, eg
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4847 )




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#5422; Package emacs,cc-mode. (Tue, 04 Oct 2011 05:35:01 GMT) Full text and rfc822 format available.

Message #18 received at 5422 <at> debbugs.gnu.org (full text, mbox):

From: Jan Djärv <jan.h.d <at> swipnet.se>
To: Glenn Morris <rgm <at> gnu.org>
Cc: "blew <at> astro.uni.torun.pl" <blew <at> astro.uni.torun.pl>,
	"5422 <at> debbugs.gnu.org" <5422 <at> debbugs.gnu.org>
Subject: Re: bug#5422: syntax highlighting bug
Date: Tue, 4 Oct 2011 07:32:57 +0200
Hello.


3 okt 2011 kl. 22:59 skrev Glenn Morris <rgm <at> gnu.org>:

> Bartosz Lew wrote:
> 
>> This is just to report on some minor C++ syntax highlighting problem
>> in emacs.
>> 
>> when I write:
>> 
>>    if (a < b->c())  { do this; } else { do that; }
>> 
>> two two things go wrong:
>> 1) parentheses matching doesn't work correctly 
>>    emacs matches the closing bracket of the if condition with the
>> "<" - "smaller > than" sign in the if condition.
>> 
>> 2) the automatic positioning of any code written below gets confused due to 
>> this parentheses matching problem.
>> 
>> I use:
>> 
>> GNU Emacs 23.1.1 (i386-redhat-linux-gnu, GTK+ Version 2.16.6)
>> of 2009-09-29 on x86-7.fedora.phx.redhat.com
> 
> I am unable to reproduce this in any version of Emacs, including 23.1.
> If you still see the problem in the latest release, please send a
> complete example starting from emacs -Q.
> 
> (There seem to have been some fixes in this area, eg
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4847 )
> 

This is one of the elusive cc-mode bugs that isn't easy to reproduce. 

AFAIK it depends on some cache in cc-mode getting out of sync. So you are more likely to see it on a large file you have edited in several places. It might even depend on what kind of editing you have done. I think this is a symptom of some underlying bug.

I see this in 23.3 and the trunk at least 2-3 times per day when editing code with a lot of templates. The < and > are mistaken for start/end brace or parentesis.

Save the file, kill the buffer, and reopen the file usually fixes it.

    Jan D.



Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#5422; Package emacs,cc-mode. (Tue, 04 Oct 2011 13:14:02 GMT) Full text and rfc822 format available.

Message #21 received at 5422 <at> debbugs.gnu.org (full text, mbox):

From: Michael Welsh Duggan <md5i <at> md5i.com>
To: Jan Djärv <jan.h.d <at> swipnet.se>
Cc: "blew <at> astro.uni.torun.pl" <blew <at> astro.uni.torun.pl>,
	Glenn Morris <rgm <at> gnu.org>, "5422 <at> debbugs.gnu.org" <5422 <at> debbugs.gnu.org>
Subject: Re: bug#5422: syntax highlighting bug
Date: Tue, 04 Oct 2011 09:11:32 -0400
Jan Djärv <jan.h.d <at> swipnet.se> writes:

> Hello.
>
>
> 3 okt 2011 kl. 22:59 skrev Glenn Morris <rgm <at> gnu.org>:
>
>> Bartosz Lew wrote:
>> 
>>> This is just to report on some minor C++ syntax highlighting problem
>>> in emacs.

[...]

>> 
>> I am unable to reproduce this in any version of Emacs, including 23.1.
>> If you still see the problem in the latest release, please send a
>> complete example starting from emacs -Q.
>> 
>> (There seem to have been some fixes in this area, eg
>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4847 )
>> 
>
> This is one of the elusive cc-mode bugs that isn't easy to reproduce. 
>
> AFAIK it depends on some cache in cc-mode getting out of sync. So you
> are more likely to see it on a large file you have edited in several
> places. It might even depend on what kind of editing you have done. I
> think this is a symptom of some underlying bug.
>
> I see this in 23.3 and the trunk at least 2-3 times per day when
> editing code with a lot of templates. The < and > are mistaken for
> start/end brace or parentesis.
>
> Save the file, kill the buffer, and reopen the file usually fixes it.

I have been having similar problems, and am really hoping this gets
fixed in the pretest.  I have an open bug (9560) which contains
information which hopefully can reproduce at least one of these cache
inconsistency errors.

-- 
Michael Welsh Duggan
(md5i <at> md5i.com)




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#5422; Package emacs,cc-mode. (Thu, 06 Oct 2011 15:43:02 GMT) Full text and rfc822 format available.

Message #24 received at 5422 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Jan Djärv <jan.h.d <at> swipnet.se>
Cc: "blew <at> astro.uni.torun.pl" <blew <at> astro.uni.torun.pl>,
	Glenn Morris <rgm <at> gnu.org>, "5422 <at> debbugs.gnu.org" <5422 <at> debbugs.gnu.org>
Subject: Re: bug#5422: syntax highlighting bug
Date: Thu, 6 Oct 2011 15:38:14 +0000
On Tue, Oct 04, 2011 at 07:32:57AM +0200, Jan Djärv wrote:
> Hello.


> 3 okt 2011 kl. 22:59 skrev Glenn Morris <rgm <at> gnu.org>:

> > Bartosz Lew wrote:

> >> This is just to report on some minor C++ syntax highlighting problem
> >> in emacs.

> >> when I write:

> >>    if (a < b->c())  { do this; } else { do that; }

> >> two two things go wrong:
> >> 1) parentheses matching doesn't work correctly 
> >>    emacs matches the closing bracket of the if condition with the
> >> "<" - "smaller > than" sign in the if condition.

> >> 2) the automatic positioning of any code written below gets confused due to 
> >> this parentheses matching problem.

> >> I use:

> >> GNU Emacs 23.1.1 (i386-redhat-linux-gnu, GTK+ Version 2.16.6)
> >> of 2009-09-29 on x86-7.fedora.phx.redhat.com

> > I am unable to reproduce this in any version of Emacs, including 23.1.
> > If you still see the problem in the latest release, please send a
> > complete example starting from emacs -Q.

> > (There seem to have been some fixes in this area, eg
> > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4847 )


> This is one of the elusive cc-mode bugs that isn't easy to reproduce. 

> AFAIK it depends on some cache in cc-mode getting out of sync. So you
> are more likely to see it on a large file you have edited in several
> places. It might even depend on what kind of editing you have done. I
> think this is a symptom of some underlying bug.

> I see this in 23.3 and the trunk at least 2-3 times per day when
> editing code with a lot of templates. The < and > are mistaken for
> start/end brace or parentesis.

The < and > are marked (with syntax-table text properties) as parens when
they "look like" template brackets, as they sort of do in the OP's code.
Many moons ago, < and > got marked as parens individually.  Now they are
only marked in pairs.

This has quite likely fixed the OP's bug.

> Save the file, kill the buffer, and reopen the file usually fixes it.

Yes.  But that "shouldn't" be necessary any more.

>     Jan D.

-- 
Alan Mackenzie (Nuremberg, Germany).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 04 Nov 2011 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 228 days ago.

Previous Next


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