From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Vasilij Schneidermann Newsgroups: gmane.emacs.bugs 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 Message-ID: <20170502211714.GB717@odonien.localdomain> References: <2136449839.36363.1493146365820@office.mailbox.org> <20170427193636.GA2683@acm> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ZGiS0Q5IWpPtfppv" X-Trace: blaine.gmane.org 1493759899 11864 195.159.176.226 (2 May 2017 21:18:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 2 May 2017 21:18:19 +0000 (UTC) Cc: 26658@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue May 02 23:18:14 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5fBW-0002zZ-7v for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 May 2017 23:18:14 +0200 Original-Received: from localhost ([::1]:33724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5fBb-0001x3-Vf for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 May 2017 17:18:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5fBR-0001va-0R for bug-gnu-emacs@gnu.org; Tue, 02 May 2017 17:18:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5fBP-0003OP-RU for bug-gnu-emacs@gnu.org; Tue, 02 May 2017 17:18:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53416) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d5fBK-0003MK-MX; Tue, 02 May 2017 17:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d5fBK-0004pQ-Hl; Tue, 02 May 2017 17:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Vasilij Schneidermann Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Tue, 02 May 2017 21:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26658 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: wontfix Original-Received: via spool by 26658-submit@debbugs.gnu.org id=B26658.149375983718509 (code B ref 26658); Tue, 02 May 2017 21:18:02 +0000 Original-Received: (at 26658) by debbugs.gnu.org; 2 May 2017 21:17:17 +0000 Original-Received: from localhost ([127.0.0.1]:51615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5fAa-0004oT-SZ for submit@debbugs.gnu.org; Tue, 02 May 2017 17:17:17 -0400 Original-Received: from mx1.mailbox.org ([80.241.60.212]:60779) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d5fAY-0004lc-Ki for 26658@debbugs.gnu.org; Tue, 02 May 2017 17:17:15 -0400 Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 6371D45BDE; Tue, 2 May 2017 23:17:08 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id WlkUcT_ZONNT; Tue, 2 May 2017 23:17:06 +0200 (CEST) Content-Disposition: inline In-Reply-To: <20170427193636.GA2683@acm> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:132205 Archived-At: --ZGiS0Q5IWpPtfppv Content-Type: text/plain; charset=utf-8 Content-Disposition: inline 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)) --ZGiS0Q5IWpPtfppv Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0001-Set-c-mode-base-map-parent-to-prog-mode-map.patch" >From d60e354b809f8a551fcdf7322ab16a623153f02f Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann 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 --ZGiS0Q5IWpPtfppv--