all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vasilij Schneidermann <mail@vasilij.de>
To: Alan Mackenzie <acm@muc.de>
Cc: 26658@debbugs.gnu.org
Subject: bug#26658: 25.2; cc-mode doesn't use prog-mode-map as parent for c-mode-base-map
Date: Tue, 2 May 2017 23:17:14 +0200	[thread overview]
Message-ID: <20170502211714.GB717@odonien.localdomain> (raw)
In-Reply-To: <20170427193636.GA2683@acm>

[-- Attachment #1: Type: text/plain, Size: 266 bytes --]

Hello again,

I've ensured the bug is present and wrote a patch that fixes the issue.
A workaround for people not using the latest cc-mode is to put the
following into their init file:

(eval-after-load 'cc-mode
  '(set-keymap-parent c-mode-base-map prog-mode-map))

[-- Attachment #2: 0001-Set-c-mode-base-map-parent-to-prog-mode-map.patch --]
[-- Type: text/x-diff, Size: 2267 bytes --]

From d60e354b809f8a551fcdf7322ab16a623153f02f Mon Sep 17 00:00:00 2001
From: Vasilij Schneidermann <vasilij.schneidermann@bevuta.com>
Date: Tue, 2 May 2017 23:12:21 +0200
Subject: [PATCH] Set c-mode-base-map parent to prog-mode-map

* cc-mode.el (c-set-keymap-parent):
New helper function for XEmacs and GNU Emacs.
(c-mode-base-map): Set keymap parent for the map to prog-mode-map
---
 lisp/progmodes/cc-mode.el | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 20c63d4dbe..dc06a30f29 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -223,20 +223,23 @@ c-initialize-cc-mode
 (defvar c-mode-base-map ()
   "Keymap shared by all CC Mode related modes.")
 
+(defun c-set-keymap-parent (map parent)
+  ;; Necessary to use `cc-bytecomp-fboundp' below since this
+  ;; function is called from top-level forms that are evaluated
+  ;; while cc-bytecomp is active when one does M-x eval-buffer.
+  (cond
+   ;; Emacs
+   ((cc-bytecomp-fboundp 'set-keymap-parent)
+    (set-keymap-parent map parent))
+   ;; XEmacs
+   ((fboundp 'set-keymap-parents)
+    (set-keymap-parents map parent))
+   ;; incompatible
+   (t (error "CC Mode is incompatible with this version of Emacs"))))
+
 (defun c-make-inherited-keymap ()
   (let ((map (make-sparse-keymap)))
-    ;; Necessary to use `cc-bytecomp-fboundp' below since this
-    ;; function is called from top-level forms that are evaluated
-    ;; while cc-bytecomp is active when one does M-x eval-buffer.
-    (cond
-     ;; Emacs
-     ((cc-bytecomp-fboundp 'set-keymap-parent)
-      (set-keymap-parent map c-mode-base-map))
-     ;; XEmacs
-     ((fboundp 'set-keymap-parents)
-      (set-keymap-parents map c-mode-base-map))
-     ;; incompatible
-     (t (error "CC Mode is incompatible with this version of Emacs")))
+    (c-set-keymap-parent map c-mode-base-map)
     map))
 
 (defun c-define-abbrev-table (name defs &optional doc)
@@ -276,6 +279,7 @@ c-bind-special-erase-keys
     nil
 
   (setq c-mode-base-map (make-sparse-keymap))
+  (c-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


  parent reply	other threads:[~2017-05-02 21:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-25 18:52 bug#26658: 25.2; cc-mode doesn't use prog-mode-map as parent for c-mode-base-map Vasilij Schneidermann
2017-04-25 18:57 ` Glenn Morris
2017-04-26  6:30 ` bug#26658: " Jostein Kjønigsen
2017-04-26  6:37   ` Vasilij Schneidermann
2017-04-27 19:36 ` bug#26658: 25.2; " Alan Mackenzie
2017-04-28  8:15   ` Vasilij Schneidermann
2017-05-02 21:17   ` Vasilij Schneidermann [this message]
2017-05-07 11:22     ` Alan Mackenzie
2017-05-07 13:58       ` Vasilij Schneidermann
2017-07-12 17:50         ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170502211714.GB717@odonien.localdomain \
    --to=mail@vasilij.de \
    --cc=26658@debbugs.gnu.org \
    --cc=acm@muc.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.