GNU bug report logs - #6978
show-paren-mode doesn't match when scope "::" operator is used : emacs 32.1.97

Previous Next

Packages: cc-mode, emacs;

Reported by: "Bob" <purchasebyemail1 <at> comcast.net>

Date: Fri, 3 Sep 2010 16:10:02 UTC

Severity: minor

Found in versions 24.0.90, 27.0.50

Done: Alan Mackenzie <acm <at> muc.de>

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 6978 in the body.
You can then email your comments to 6978 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#6978; Package emacs. (Fri, 03 Sep 2010 16:10:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Bob" <purchasebyemail1 <at> comcast.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 03 Sep 2010 16:10:03 GMT) Full text and rfc822 format available.

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

From: "Bob" <purchasebyemail1 <at> comcast.net>
To: <bug-gnu-emacs <at> gnu.org>
Subject: show-paren-mode doesn't match when scope "::" operator is used :
	emacs 32.1.97
Date: Fri, 3 Sep 2010 09:05:11 -0700
[Message part 1 (text/plain, inline)]
 

Emacs 23.1.97:

 

When using the C++ scope operator "::", show-paren-mode gets confused:

 

------  Foo.cpp ------------------------------------

struct Foo1 {};

 

namespace X

{

  struct Foo2 {};

 

  template<class _Y>

  struct Bar;

 

  template<>

  struct Bar<::Foo1>         // "(show-paren-mode)" does not match `>` to
`<`

  {

  };

 

  template<>

  struct Bar<Foo2>           // "(show-paren-mode)" correctly matches `>` to
`<` 

  {

  };

}

---------------------------------------------

[Message part 2 (text/html, inline)]

bug Marked as found in versions 24.0.90. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 03 Oct 2011 20:29:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#6978; Package emacs,cc-mode. (Sun, 06 Oct 2019 11:40:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Bob <purchasebyemail1 <at> comcast.net>
Cc: 6978 <at> debbugs.gnu.org
Subject: Re: bug#6978: show-paren-mode doesn't match when scope "::" operator
 is used : emacs 32.1.97
Date: Sun, 6 Oct 2019 13:39:24 +0200
severity 6978 minor
found 6978 27.0.50
quit

"Bob" <purchasebyemail1 <at> comcast.net> writes:

>
>
> Emacs 23.1.97:
>
>
>
> When using the C++ scope operator "::", show-paren-mode gets confused:
>
>
>
> ------  Foo.cpp ------------------------------------
>
> struct Foo1 {};
>
>
>
> namespace X
>
> {
>
>   struct Foo2 {};
>
>
>
>   template<class _Y>
>
>   struct Bar;
>
>
>
>   template<>
>
>   struct Bar<::Foo1>         // "(show-paren-mode)" does not match `>` to `<`
>
>   {
>
>   };
>
>
>
>   template<>
>
>   struct Bar<Foo2>           // "(show-paren-mode)" correctly matches `>` to `<`
>
>   {
>
>   };
>
> }
>
> ---------------------------------------------

I can reproduce this on current master.

Best regards,
Stefan Kangas




Severity set to 'minor' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sun, 06 Oct 2019 11:40:02 GMT) Full text and rfc822 format available.

bug Marked as found in versions 27.0.50. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sun, 06 Oct 2019 11:40:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#6978; Package emacs,cc-mode. (Sun, 06 Oct 2019 17:39:02 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 6978 <at> debbugs.gnu.org
Subject: Re: bug#6978: show-paren-mode doesn't match when scope "::" operator
 is used : emacs 32.1.97
Date: 6 Oct 2019 17:38:50 -0000
In article <mailman.1087.1570362019.2651.bug-gnu-emacs <at> gnu.org> you wrote:
> severity 6978 minor
> found 6978 27.0.50
> quit

> "Bob" <purchasebyemail1 <at> comcast.net> writes:

>>
>>
>> Emacs 23.1.97:
>>
>>
>>
>> When using the C++ scope operator "::", show-paren-mode gets confused:
>>
>>
>>
>> ------  Foo.cpp ------------------------------------
>>
>> struct Foo1 {};
>>
>>
>>
>> namespace X
>>
>> {
>>
>>   struct Foo2 {};
>>
>>
>>
>>   template<class _Y>
>>
>>   struct Bar;
>>
>>
>>
>>   template<>
>>
>>   struct Bar<::Foo1>         // "(show-paren-mode)" does not match `>` to `<`
>>
>>   {
>>
>>   };
>>
>>
>>
>>   template<>
>>
>>   struct Bar<Foo2>           // "(show-paren-mode)" correctly matches `>` to `<`
>>
>>   {
>>
>>   };
>>
>> }
>>
>> ---------------------------------------------

> I can reproduce this on current master.

This is a CC Mode bug.  The pertinent < and > are not being marked with
syntax-table text properties, hence can't be recognised as parens.

I'll be looking into this.

> Best regards,
> Stefan Kangas

-- 
Alan Mackenzie (Nuremberg, Germany).





Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#6978; Package emacs,cc-mode. (Sun, 06 Oct 2019 18:57:02 GMT) Full text and rfc822 format available.

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

From: Richard Copley <rcopley <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 6978 <at> debbugs.gnu.org, Stefan Kangas <stefan <at> marxist.se>
Subject: Re: bug#6978: show-paren-mode doesn't match when scope "::" operator
 is used : emacs 32.1.97
Date: Sun, 6 Oct 2019 19:56:19 +0100
[Message part 1 (text/plain, inline)]
On Sun, 6 Oct 2019 at 18:39, Alan Mackenzie <acm <at> muc.de> wrote:

> In article <mailman.1087.1570362019.2651.bug-gnu-emacs <at> gnu.org> you wrote:
> > "Bob" <purchasebyemail1 <at> comcast.net> writes:
> >>   struct Bar<::Foo1>         // "(show-paren-mode)" does not match `>`
> to `<`
> The pertinent < and > are not being marked with
> syntax-table text properties, hence can't be recognised as parens.
>

Digraphs? (Just a thought.)

Best,
Richard.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#6978; Package emacs,cc-mode. (Sun, 06 Oct 2019 19:17:02 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Richard Copley <rcopley <at> gmail.com>
Cc: 6978 <at> debbugs.gnu.org
Subject: Re: bug#6978: show-paren-mode doesn't match when scope "::" operator
 is used : emacs 32.1.97
Date: 6 Oct 2019 19:16:07 -0000
Hello, Richard.

In article <mailman.1131.1570388227.2651.bug-gnu-emacs <at> gnu.org> you wrote:
> [-- text/plain, encoding 7bit, charset: UTF-8, 15 lines --]

> On Sun, 6 Oct 2019 at 18:39, Alan Mackenzie <acm <at> muc.de> wrote:

>> In article <mailman.1087.1570362019.2651.bug-gnu-emacs <at> gnu.org> you wrote:
>> > "Bob" <purchasebyemail1 <at> comcast.net> writes:
>> >>   struct Bar<::Foo1>         // "(show-paren-mode)" does not match `>`
>> >>   to `<`
>> The pertinent < and > are not being marked with
>> syntax-table text properties, hence can't be recognised as parens.
>>

> Digraphs? (Just a thought.)

Spot on!

I just need to find a way of removing <: from the regexp used to check
the opening <.  Shouldn't be too difficult.

Why on earth are digraphs still an issue?  Why are they still in the C
and C++ standards?  It's been several decades since "complete" character
sets (here, meaning ASCII) superseded incomplete ones.

> Best,
> Richard.

-- 
Alan Mackenzie (Nuremberg, Germany).





Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#6978; Package emacs,cc-mode. (Sun, 06 Oct 2019 20:12:01 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Richard Copley <rcopley <at> gmail.com>, Stefan Kangas <stefan <at> marxist.se>
Cc: 6978 <at> debbugs.gnu.org
Subject: Re: bug#6978: show-paren-mode doesn't match when scope "::" operator
 is used : emacs 32.1.97
Date: Sun, 6 Oct 2019 20:11:36 +0000
Hello, Stefan and Richard.

On Sun, Oct 06, 2019 at 19:16:07 -0000, Alan Mackenzie wrote:
> In article <mailman.1131.1570388227.2651.bug-gnu-emacs <at> gnu.org> you wrote:
> > [-- text/plain, encoding 7bit, charset: UTF-8, 15 lines --]

> > On Sun, 6 Oct 2019 at 18:39, Alan Mackenzie <acm <at> muc.de> wrote:

> >> In article <mailman.1087.1570362019.2651.bug-gnu-emacs <at> gnu.org> you wrote:
> >> > "Bob" <purchasebyemail1 <at> comcast.net> writes:
> >> >>   struct Bar<::Foo1>         // "(show-paren-mode)" does not match `>`
> >> >>   to `<`
> >> The pertinent < and > are not being marked with
> >> syntax-table text properties, hence can't be recognised as parens.

> > Digraphs? (Just a thought.)

> Spot on!

> I just need to find a way of removing <: from the regexp used to check
> the opening <.  Shouldn't be too difficult.

The following seems to fix the bug:



diff -r b0943da37755 cc-langs.el
--- a/cc-langs.el	Thu Oct 03 14:14:45 2019 +0000
+++ b/cc-langs.el	Sun Oct 06 20:08:43 2019 +0000
@@ -1382,11 +1382,11 @@
 
 (c-lang-defconst c-<-op-cont-regexp
   ;; Regexp matching the second and subsequent characters of all
-  ;; multicharacter tokens that begin with "<".
+  ;; multicharacter tokens that begin with "<", apart from digraphs.
   t (c-make-keywords-re nil
       (c-filter-ops (c-lang-const c-all-op-syntax-tokens)
 		    t
-		    "\\`<."
+		    "\\`<[^:]"
 		    (lambda (op) (substring op 1)))))
 (c-lang-defvar c-<-op-cont-regexp (c-lang-const c-<-op-cont-regexp))
 


> > Best,
> > Richard.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#6978; Package emacs,cc-mode. (Sun, 06 Oct 2019 20:22:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Richard Copley <rcopley <at> gmail.com>, 6978 <at> debbugs.gnu.org
Subject: Re: bug#6978: show-paren-mode doesn't match when scope "::" operator
 is used : emacs 32.1.97
Date: Sun, 6 Oct 2019 22:21:39 +0200
Hi Alan,

Alan Mackenzie <acm <at> muc.de> writes:

> The following seems to fix the bug:

I can verify that applying your patch to current master fixes the bug
for me.  I think you can push and close this bug.  Thanks for fixing
it.

Best regards,
Stefan Kangas




Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Fri, 11 Oct 2019 19:33:02 GMT) Full text and rfc822 format available.

Notification sent to "Bob" <purchasebyemail1 <at> comcast.net>:
bug acknowledged by developer. (Fri, 11 Oct 2019 19:33:02 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Richard Copley <rcopley <at> gmail.com>, 6978-done <at> debbugs.gnu.org
Subject: Re: bug#6978: show-paren-mode doesn't match when scope "::" operator
 is used : emacs 32.1.97
Date: Fri, 11 Oct 2019 19:32:48 +0000
Hello, Stefan.

On Sun, Oct 06, 2019 at 22:21:39 +0200, Stefan Kangas wrote:
> Hi Alan,

> Alan Mackenzie <acm <at> muc.de> writes:

> > The following seems to fix the bug:

> I can verify that applying your patch to current master fixes the bug
> for me.  I think you can push and close this bug.  Thanks for fixing
> it.

I've actually developed a longer, more rigorous patch, which I've
committed.  The C++ standard says that although <:: should be recognised
as a template opener, <::>, and <::: should not be.  The committed patch
follows this.

I'm closing the bug with this post.

> Best regards,
> Stefan Kangas

-- 
Alan Mackenzie (Nuremberg, Germany).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 09 Nov 2019 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 223 days ago.

Previous Next


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