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

Previous Next

Packages: emacs, cc-mode;

Reported by: glaysher <at> umich.edu

Date: Thu, 31 Mar 2016 21:21:03 UTC

Severity: wishlist

Tags: patch

Merged with 26658

Found in version 25.2

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23175 in the body.
You can then email your comments to 23175 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23175; Package emacs. (Thu, 31 Mar 2016 21:21:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to glaysher <at> umich.edu:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 31 Mar 2016 21:21:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Elliot Glaysher <eglaysher <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: CC Mode 5.33 (C++/l); `c-mode-base-map' has no parent keymap
Date: Wed, 30 Mar 2016 22:51:15 -0700
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.

This can be fixed by adding a call to set-keymap-parent right after
c-mode-base-map gets set to a sparse map, but a more complicated fix
is probably needed if you care about xemacs compatibility (and
`c-make-inherited-keymap' implies that you do).

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

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




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#23175; Package emacs,cc-mode. (Wed, 08 Jun 2016 11:20:01 GMT) Full text and rfc822 format available.

Message #8 received at 23175 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: glaysher <at> umich.edu
Cc: 23175 <at> debbugs.gnu.org
Subject: Re: bug#23175: CC Mode 5.33 (C++/l);
 `c-mode-base-map' has no parent keymap
Date: 8 Jun 2016 11:19:25 -0000
Hello, Elliot.

In article <mailman.8736.1459459266.843.bug-gnu-emacs <at> 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).





Added tag(s) wontfix. Request was from Alan Mackenzie <acm <at> muc.de> to control <at> debbugs.gnu.org. (Wed, 08 Jun 2016 11:28:02 GMT) Full text and rfc822 format available.

Merged 23175 26658. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 25 Apr 2017 19:01:01 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Thu, 04 May 2017 03:51:02 GMT) Full text and rfc822 format available.

Added tag(s) patch; removed tag(s) wontfix. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Thu, 04 May 2017 03:51:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 10 Aug 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 116 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.