Subject: bug#21465: [PATCH] CC-modes hierarchy

From: Mark Oteiza <[email-masked]>
Date: Sat, 12 Sep 2015 12:51:47 -0400

Stefan Monnier <[email-masked]> writes:

> Package: Emacs
> Version: 25.0.50
> - Move code common to all CC-mode major modes to a c-mode-common-mode function.
> - Add new c-derivative-mode as a parent of C, C++, and ObjC, for
>   settings which apply to C-derived languages but not for others.
>   This has become necessary given that CC-mode is used nowadays as an
>   engine for modes which have little to do with C.
>  ...
> - Remove c-make-inherited-keymap, since it's not used any more.

It is not clear to me how to adapt a 3rd party derived mode to
this. Granted, it was never clear to me how to make a mode derived from
CC mode, but that's another thread.

For mode derivation, either I have

(define-derived-mode foo++-mode c++-mode "Foo++"
 ...)

In which case there will be a parent c++-mode-map and a C++ menu present
when there shouldn't be, or:

(define-derived-mode foo++-mode c-derivative-mode "Foo++"
 ...)

and fontification is broken.

I've attached an example: