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: Sun, 7 May 2017 15:58:34 +0200	[thread overview]
Message-ID: <20170507135834.GB645@odonien.localdomain> (raw)
In-Reply-To: <20170507112229.GA22721@acm.fritz.box>

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

> 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.

[-- Attachment #2: 0001-Make-prog-mode-map-the-parent-of-c-mode-base-map.patch --]
[-- Type: text/x-diff, Size: 944 bytes --]

From 1e4a92e05b78edb2f58c138aa7792d39a6d9a9cb Mon Sep 17 00:00:00 2001
From: Vasilij Schneidermann <vasilij.schneidermann@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


  reply	other threads:[~2017-05-07 13:58 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
2017-05-07 11:22     ` Alan Mackenzie
2017-05-07 13:58       ` Vasilij Schneidermann [this message]
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=20170507135834.GB645@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.