[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keymap initialization (was: [Emacs-diffs] master 7a2038d: Create a t

From: Alan Mackenzie
Subject: Re: Keymap initialization (was: [Emacs-diffs] master 7a2038d: Create a toggle between block and line comments in CC Mode)
Date: Mon, 26 Jun 2017 16:39:57 +0000
User-agent: Mutt/1.7.2 (2016-11-26)

Hello, Stefan.

On Sun, Jun 25, 2017 at 17:29:56 -0400, Stefan Monnier wrote:
> >     Create a toggle between block and line comments in CC Mode.
> [...]
> >     (c-mode-map, c++-mode-map, objc-mode-map, java-mode-map, idl-mode-map)
> >     (pike-mode-map, awk-mode-map): Make entries in these key maps each time
> >     the mode is loaded rather than just once per Emacs session.

> This seems completely unrelated.

As the commit message (the bit you snipped) said.

> >  (defvar pike-mode-map
> >    (let ((map (c-make-inherited-keymap)))
> > -    ;; Additional bindings.
> > -    (define-key map "\C-c\C-e" 'c-macro-expand)
> >      map)
> >    "Keymap used in pike-mode buffers.")
> > +;; Additional bindings.
> > +(define-key pike-mode-map "\C-c\C-e" 'c-macro-expand)

> This is anti-idiomatic: Emacs's own code has been making the
> opposite change over the years in most/all bundled packages.

I got sick and tired of having to do M-: (makunbound 'foo-map) before
loading files with changed keymaps.  As a developer yourself, you should
welcome such changes.

> There are many ways to skin this cat; the two alternatives above have
> both advantages and disadvantages, so I think we should agree on one and
> stick to it.  Consistency is not Emacs's forte and is not something that
> I consider indispensable, but I really don't see why CC-mode's keymaps
> need to behave differently from all other major modes.

They don't.  You press a pertinent key combination and the key maps take
you to the matching command.  Precisely how these keymaps are
constructed and loaded is of lesser importance.

>         Stefan

Alan Mackenzie (Nuremberg, Germany).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]