GNU bug report logs - #26658
25.2; cc-mode doesn't use prog-mode-map as parent for c-mode-base-map

Previous Next

Packages: emacs, cc-mode;

Reported by: Vasilij Schneidermann <mail <at> vasilij.de>

Date: Tue, 25 Apr 2017 18:55:01 UTC

Severity: wishlist

Tags: patch

Merged with 23175

Found in version 25.2

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Alan Mackenzie <acm <at> muc.de>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#23175: closed (CC Mode 5.33 (C++/l); `c-mode-base-map' has no
 parent keymap)
Date: Wed, 12 Jul 2017 17:52:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 12 Jul 2017 17:50:03 +0000
with message-id <20170712175003.GA13295 <at> acm>
and subject line Re: bug#26658: 25.2; cc-mode doesn't use prog-mode-map as parent for c-mode-base-map
has caused the debbugs.gnu.org bug report #26658,
regarding CC Mode 5.33 (C++/l); `c-mode-base-map' has no parent keymap
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
26658: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=26658
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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


[Message part 3 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: Vasilij Schneidermann <mail <at> vasilij.de>
Cc: 26658-done <at> debbugs.gnu.org
Subject: Re: bug#26658: 25.2; cc-mode doesn't use prog-mode-map as parent for
 c-mode-base-map
Date: Wed, 12 Jul 2017 17:50:03 +0000
Hello, Vasilij.

On Sun, May 07, 2017 at 15:58:34 +0200, Vasilij Schneidermann wrote:
[ .... ]

> > Do you have commit access to the Emacs repository?

> No and I doubt I'll ever get it because I don't understand the commit
> message rules at all.  They appear to be loosely based upon GNU
> changelog guidelines, but with everyone I send patches to interpreting
> them differently, probably because there isn't much substance to them in
> the first place.  I've resorted to using M-x add-change-log-entry,
> copying the result into the commit message and adjusting it describing
> my changes, but there's apparently more to it than that.

I've committed your patch, slightly altered, and am closing the bug.  I
suspect that the commit message I used will be yet another variant.  ;-(
Thanks again for that patch.

> Anyway, here's an updated patch.

> >>From 1e4a92e05b78edb2f58c138aa7792d39a6d9a9cb Mon Sep 17 00:00:00 2001
> From: Vasilij Schneidermann <vasilij.schneidermann <at> bevuta.com>
> Date: Sun, 7 May 2017 15:55:49 +0200
> Subject: [PATCH] Make prog-mode-map the parent of c-mode-base-map

> Fixes #26658.

> * lisp/progmodes/cc-mode.el (c-mode-base-map): Make prog-mode-map the
>   parent of c-mode-map if possible.
> ---
>  lisp/progmodes/cc-mode.el | 3 +++
>  1 file changed, 3 insertions(+)

> diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
> index 20c63d4dbe..8f9e40bb0d 100644
> --- a/lisp/progmodes/cc-mode.el
> +++ b/lisp/progmodes/cc-mode.el
> @@ -276,6 +276,9 @@ c-bind-special-erase-keys
>      nil

>    (setq c-mode-base-map (make-sparse-keymap))
> +  (when (and (cc-bytecomp-fboundp 'set-keymap-parent)
> +	     (boundp 'prog-mode-map))
> +    (set-keymap-parent c-mode-base-map prog-mode-map))

>    ;; Separate M-BS from C-M-h.  The former should remain
>    ;; backward-kill-word.
> -- 
> 2.12.2

-- 
Alan Mackenzie (Nuremberg, Germany).


This bug report was last modified 8 years ago.

Previous Next


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