From 78923c5f4e26d3cb9fbaf0dbf2d04c523482e52c Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Wed, 24 Aug 2022 19:27:32 +0000 Subject: [PATCH] C++ Mode - Fontify "class Foo {\n ~Foo() noexcept;" correctly This fixes bug #49787. * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): (In `if' form just before CASE 8) Remove the (not ...) around the (looking-at c-after-suffixed-type-maybe-decl-key). * lisp/progmodes/cc-fonts.el (c-font-lock-complex-decl-prepare): Add `c-not-decl' to the values of c-type which are erased at the start of a fontification. --- lisp/progmodes/cc-engine.el | 4 ++-- lisp/progmodes/cc-fonts.el | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index f46c909fea5..1139423a455 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -10571,8 +10571,8 @@ This function might do hidden buffer changes." backup-maybe-typeless (when c-recognize-typeless-decls (or (not got-suffix) - (not (looking-at - c-after-suffixed-type-maybe-decl-key)))))) + (looking-at + c-after-suffixed-type-maybe-decl-key))))) ;; Got an empty paren pair and a preceding type that probably ;; really is the identifier. Shift the type backwards to make ;; the last one the identifier. This is analogous to the diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 2495d21a10f..12bb3d37513 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -940,7 +940,8 @@ casts and declarations are fontified. Used on level 2 and higher." '(c-decl-arg-start c-decl-end c-decl-id-start - c-decl-type-start))) + c-decl-type-start + c-not-decl))) (1- (point)) pos) limit 'c-type))) -- 2.39.2