From fc88895a0daa9f43c789650ac7f0438cd2466811 Mon Sep 17 00:00:00 2001 From: Naofumi Yasufuku Date: Sun, 28 Aug 2022 13:33:01 +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) (bug#57318). --- lisp/progmodes/cc-engine.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index b2d1f15d39..5d1a11e9e8 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -6141,13 +6141,18 @@ 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)) + ;; for "class foo" + (setq s (cons -1 (cdr s))))) ((and (equal match ":") s (eq (car s) 0)) + ;; for "," in "class foo : bar, .." (setq s (cons -1 (cdr s)))) - ((and (equal match ",") - (eq (car s) -1))) ; at "," in "class foo : bar, ..." + ((and (eq (car s) -1) ; in "class foo : .." or "class foo<..>" + (member match '("*" "," ")")))) ((member match '(";" "*" "," ")")) (when (and s (cdr s) (<= (car s) 0)) (setq s (cdr s)))) -- 2.37.2