emacs-devel
[Top][All Lists]
Advanced

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

Re: function-key-map


From: Stefan Monnier
Subject: Re: function-key-map
Date: Fri, 12 Oct 2007 11:19:25 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

Stefan> Yes, it's still very useful.  See for example how
Stefan> term/xterm.el uses both.  Or term/x-win.el.
Stefan> I.e. it's useful to give optional remapping
Stefan> corresponding to alternative key-names.

> Is there a reason to use `function-key-map' for this,
> rather than `key-translation-map'?  Is it so that they won't
> be translated if they have bindings?

Yes.  Those mappings are "tentative".  E.g. mapping [f23] to [S-f11] is not
guaranteed to be correct, and even less so for [f13] -> [S-f1] if your
keyboard does have an key f13.
So it's a bit like giving those events several names rather than rewrite one
name to another.

function-key-map under X11 should also contain mappings from mouse-4 to
wheel-up, and here again this mapping is tentative: mouse-4 often is the
button that corresponds to the up movement of a mouse wheel, but sometimes
it is just a plain extra mouse button, so the reampping of mouse-4 to
wheel-up should only be done if mouse-4 has no binding.

> In any case, the name `function-key-map' doesn't fit this kind of
> usage.  I gave it that name because its main purpose was to map escape
> sequences into function keys, but that job is now done by
> `input-decode-map'.

> So perhaps we should rename the current `function-key-map' to
> `default-key-translation-map', then rename the current
> `input-decode-map' to `function-key-map'.

> What do you think?

I agree that function-key-map is a misnomer now.

The choice of `input-decode-map' was somewhat arbitrary.  It was based on
the fact that it is used by encoded-kb.el and also that the tty escape
sequences for function keys are a form of "encoding" of non-ascii events
onto an ascii stream.  I'm not wedded to this name, tho I think the name
makes sense and describes well what it does.

Renaming input-decode-map to function-key-map would be a bad idea because it
would introduce an incompatibility: the behavior of input-decode-map is
different, so while some uses of function-key-map are better moved to
input-decode-map, others (such as the ones mentioned at the beginning of
this message) need to stay on function-key-map.  Actually the name
function-key-map would also be bad because it would fail to describe what
the map does (and instead describes what it was meant for).

Renaming function-key-map to `default-key-translation-map' would also seem
like a bad idea:
- the name seems to imply that it's the global binding of "the
  buffer-local key-translation-map".
- the name suggests the behavior of that map will be the same as the behavior
  of `key-translation-map' although in reality it is different.

Right now, in the term/*.el files that I've changed to take advantage of
input-decode-map, I've used "foo-alternative-maps" for the keymaps that
hold bindings that need to be added to function-key-map, so maybe we could
rename function-key-map to alternative-input-names-map or
fallback-input-rename-map?


        Stefan




reply via email to

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