emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Rebinding international characters


From: Luc Teirlinck
Subject: Re: Rebinding international characters
Date: Thu, 5 Aug 2004 21:08:51 -0500 (CDT)

Stefan Monnier wrote:

   Yes, this is a known problem which I pointed out last time I worked on
   this code.  Fixing it is very difficult.  Luckily it rarely if ever
   introduces problems.

I believe that this is because sequences bound in `function-key-map',
or their prefixes, are either rarely rebound or of the type that will
not that easily cause problems.

Actually, I believe that there are two kinds of bindings in
`function-key-map'.  First, there are the ones that do exactly what the
description in the Elisp manual says:

     This variable holds a keymap that describes the character
     sequences sent by function keys on an ordinary character
     terminal.

A typical example is the "\C-[[21~" (or, equivalently, [?\M-\[ 2 1 ~])
binding of f10 on text-only terminals.  If you try to rebind one of
those, you are very likely to hang yourself.  Giving a regular binding
to M-[ on a text-only terminal does not seem terribly advisable.
Going into terrible complexities to allow a user to hang himself by
rebinding M-[ on a text-only terminal does not seem warranted.

A second type of elements are the ones that translate a less familiar
key into a very similar key, like the one binding kp-home to home.
Here it is perfectly legitimate to give a regular binding to kp-home,
different from home's binding.  (And I would not be surprised if many
people actually did.)

I guess that the rule that regular bindings should override
`function-key-map' was inspired by the (kp-home . [home]) type example.
I believe that is someone would want to give bindings for sequences
containing home or kp-home in `key-translation-map', then that person 
should take into account that the user may have rebound kp-home.  (One
more reason for my proposed remark.)

Maybe one should have three keymaps instead of two.
`function-key-map' for the f10 type overrides everything else.  Then
`key-translation-map' goes to work, with kp-home still separate from
home.  Then come the regular bindings.  Finally, the fourth, new,
keymap goes to work.  If kp-home is still unbound, it gets home's
binding.  This seems to be a routine algorithm (actually too simple to
deserve that name) without special cases.

But maybe it is too late to do this, even assuming that it would make
sense.  Certainly, this is too much of a change to do while preparing
for a release.

Postscript:  The M-[ situation could easily arise.  Assume somebody
uses a window system most of the time, but uses `emacs -nw' when using
Emacs over a slow connection.  (A situation that applies to many
people).  While using Emacs on a window system, one sees that M-[ is
unbound.  So one binds it to, say, beginning-of-buffer (or whatever).
Then, while using `emacs -nw', one presses f10 to invoke the menubar.
No menubar props up, but point goes to the original beginning of the
buffer preceded by "21~".

Sincerely,

Luc.








reply via email to

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