bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23175: CC Mode 5.33 (C++/l); `c-mode-base-map' has no parent keymap


From: Alan Mackenzie
Subject: bug#23175: CC Mode 5.33 (C++/l); `c-mode-base-map' has no parent keymap
Date: 8 Jun 2016 11:19:25 -0000
User-agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.3-RELEASE (amd64))

Hello, Elliot.

In article <mailman.8736.1459459266.843.bug-gnu-emacs@gnu.org> you wrote:
> While all the modes defined in cc-mode.el derive from `prog-mode', their
> keymaps do not derive from `prog-mode-map'. Their definitions do not
> trigger the call to `set-keymap-parent' that `define-derived-mode'
> usually does automatically.

As you know, the structure of the CC Mode keymaps is one map per mode
(each of which has a small number of bindings) and c-mode-base-map
(containing the bulk of the modes' bindings) which is the parent of the
other ones.

> This can be fixed by adding a call to set-keymap-parent right after
> c-mode-base-map gets set to a sparse map, .....

I'm not convinced this is true.  This make-sparse-keymap call for
c-mode-base-map happens at the top level of cc-mode.el, and it's not
clear that prog-mode.elc has been loaded yet.  I suppose we could insert
a (require 'prog-mode), but that's untidy and might have other issues.

> ..... but a more complicated fix is probably needed if you care about
> xemacs compatibility (and `c-make-inherited-keymap' implies that you
> do).

I most certainly do care about XEmacs!

There's a slow process underway (slow, largely because of me dragging my
feet) where define-derived-mode is gradually acquiring features which
make it easier for CC Mode's mode commands to adapt to, without loss of
functionality.  Originally, define-derived-mode was a bit of a
straightjacket in what it allowed major modes to do, and CC Mode's mode
commands (which are very old indeed, over 20 years old) didn't fit well
into this.  In Emacs 25.2, there will be a further fix, whereby the major
mode hooks don't get called twice, but you probably know that already.

> See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14504 for another case
> where this happened in `emacs-lisp-mode'.

Another way of looking at this is that there's currently nothing in
prog-mode-map that CC Mode can use; prog-indent-sexp wouldn't work
properly in CC Mode's modes even if its keybinding wasn't shadowed by a
CC Mode command.

So, I think I'd rather leave this change until there's something
compelling in prog-mode-map.  For now, I'm going to mark the bug as
"won't fix".

But, all the same, thank you for the bug report!

> Emacs  : GNU Emacs 25.1.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.16.7)
>  of 2016-03-24
> Package: CC Mode 5.33 (C++/l)
> Buffer Style: google
> c-emacs-features: (pps-extended-state col-0-paren posix-char-classes
> gen-string-delim gen-comment-delim syntax-properties 1-bit)


> -- 
> -- Elliot

-- 
Alan Mackenzie (Nuremberg, Germany).






reply via email to

[Prev in Thread] Current Thread [Next in Thread]