>From f8c2d7c8d562f92ab9d8eb22a8f661f5ceb6e39c Mon Sep 17 00:00:00 2001 From: Naofumi Yasufuku Date: Sun, 21 Aug 2022 21:06:13 +0900 Subject: [PATCH] cc-mode: Fix function fontification in the case of C++ partial specialization * lisp/progmodes/cc-engine.el (c-update-brace-stack): Skip "," and "*" found in "class foo : bar, ..." (base-clause of a class) or "class foo" (partial template specialization). --- lisp/progmodes/cc-engine.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index bc6155dd66..f5d81cb530 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -6141,13 +6141,16 @@ c-update-brace-stack (c-forward-<>-arglist nil)) ; Should always work. (when (> (point) to) (setq bound-<> (point))) - (forward-char))) + (forward-char)) + (if (and s + (eq (car s) 0)) + (setq s (cons -1 (cdr s))))) ; for "class foo" ((and (equal match ":") s (eq (car s) 0)) - (setq s (cons -1 (cdr s)))) - ((and (equal match ",") - (eq (car s) -1))) ; at "," in "class foo : bar, ..." + (setq s (cons -1 (cdr s)))) ; for "," in "class foo : bar, ..." + ((and (member match '("*" ",")) + (eq (car s) -1))) ; in "class foo : ..." or "class foo<...>" ((member match '(";" "*" "," ")")) (when (and s (cdr s) (<= (car s) 0)) (setq s (cdr s)))) -- 2.37.2