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

From: Alan Mackenzie <[email-masked]>
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 <[email-masked]> you wrote:
> > [-- text/plain, encoding 7bit, charset: UTF-8, 15 lines --]

> > On Sun, 6 Oct 2019 at 18:39, Alan Mackenzie <[email-masked]> wrote:

> >> In article <[email-masked]> you wrote:
> >> > "Bob" <[email-masked]> 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).