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: Sun, 7 May 2017 15:58:34 +0200 Message-ID: <20170507135834.GB645@odonien.localdomain> References: <2136449839.36363.1493146365820@office.mailbox.org> <20170427193636.GA2683@acm> <20170502211714.GB717@odonien.localdomain> <20170507112229.GA22721@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="r5Pyd7+fXNt84Ff3" X-Trace: blaine.gmane.org 1494165620 11934 195.159.176.226 (7 May 2017 14:00:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 7 May 2017 14:00:20 +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 Sun May 07 16:00:15 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 1d7MjO-0002vD-Eg for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 May 2017 16:00:14 +0200 Original-Received: from localhost ([::1]:55692 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7MjR-0005Yr-33 for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 May 2017 10:00:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7MjJ-0005Um-MA for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 10:00:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7MjI-0007ZS-Kx for bug-gnu-emacs@gnu.org; Sun, 07 May 2017 10:00:09 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:33966) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d7MjD-0007Tx-0k; Sun, 07 May 2017 10:00:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d7MjC-0004bu-OF; Sun, 07 May 2017 10:00: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: Sun, 07 May 2017 14:00: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: patch Original-Received: via spool by 26658-submit@debbugs.gnu.org id=B26658.149416554117613 (code B ref 26658); Sun, 07 May 2017 14:00:02 +0000 Original-Received: (at 26658) by debbugs.gnu.org; 7 May 2017 13:59:01 +0000 Original-Received: from localhost ([127.0.0.1]:60398 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7MiD-0004Zy-EU for submit@debbugs.gnu.org; Sun, 07 May 2017 09:59:01 -0400 Original-Received: from mx2.mailbox.org ([80.241.60.215]:40420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7MiB-0004Zf-HU for 26658@debbugs.gnu.org; Sun, 07 May 2017 09:59:00 -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 mx2.mailbox.org (Postfix) with ESMTPS id 0B510448D6; Sun, 7 May 2017 15:58:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter03.heinlein-hosting.de (spamfilter03.heinlein-hosting.de [80.241.56.117]) (amavisd-new, port 10030) with ESMTP id y30NNWbdJ3lA; Sun, 7 May 2017 15:58:51 +0200 (CEST) Content-Disposition: inline In-Reply-To: <20170507112229.GA22721@acm.fritz.box> 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:132341 Archived-At: --r5Pyd7+fXNt84Ff3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline > It doesn't seem to be quite right in the way it handles XEmacs stuff, > but I don't think it's possible to be "right" here, at least not > sensibly. If this patch were to be applied to standalone CC Mode, it > would test (derived-mode-p 'prog-mode) before calling > (c-set-keymap-parent c-mode-base-map prog-mode-map). prog-mode does not > exist in XEmacs, and is unlikely ever to exist there. > > But this code is purely for Emacs. What do you think? Hm, I don't really have a way to test this in XEmacs anyway. Testing for prog-mode sounds like a good idea, but will the above example do the right thing? The issue with `derived-mode-p` is that it works upon the *current* major mode instead of accepting a major mode to test against other major modes. What is the current major mode when this line is evaluated? Wouldn't it make more sense to use (boundp 'prog-mode-map), considering that we're using the variable, not the mode? > For the commit message, the format is to aim for a complete first line > which makes sense on its own. (It's a sentence, but without a > terminating full stop.) So something like this would do: > > ######################################################################### > Make prog-mode-map the keymap parent of c-mode-base-map > > Fixes bug #26658. > > * lisp/progmodes/cc-mode.el (c-set-keymap-parent): New function > extracted from c-make-inherited-keymap. > (c-mode-base-map): ....... > > ######################################################################### > > Note that the path is given before "cc-mode.el". > > 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. Anyway, here's an updated patch. --r5Pyd7+fXNt84Ff3 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0001-Make-prog-mode-map-the-parent-of-c-mode-base-map.patch" >From 1e4a92e05b78edb2f58c138aa7792d39a6d9a9cb Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann 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 --r5Pyd7+fXNt84Ff3--