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

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

Re: Rebinding international characters


From: Stefan Monnier
Subject: Re: Rebinding international characters
Date: 27 Jul 2004 10:07:48 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> I'm now working on changing encoded-kdb.el to setup key-translation-map (I
> think it is more suitable than function-key-map).

I'd tend to agree that key-translation-map is more suitable, although using
function-key-map would have the advantage that people's old bindings like
(global-set-key [241] 'foobar) would still work.

OTOH such bindings are fundamentally wrong IMNSHO (although it's the "only"
thing that works in older Emacsen).

> When a key translation function is called, what is the right
> way to know what key invoked that function?  Is (aref
> (this-single-command-keys) 0) the right way?

How about `last-input-event' ?

Of course, that won't work if the key looked up in key-translation-map is
the result of a mapping in function-key-map rather than a key directly hit
by the user, but it shouldn't be too much of a problem.

> When a key sequence is just to change internal state
> (e.g. the case ESC $ B is sent to Emacs when
> keyboard-coding-system is iso-2022-jp), what should the
> corresponding key translation function return?

Since it's supposed to return a sequence of events (array or string),
I guess an empty string is fine, although nil might work as well.  I'm not
sure how well the keyboard.c code (it's quite brittle) deals with such
a case, but there's no obvious reason why it should fail.

I looked at how C-x 8 works, but that code pre-computes a keymap instead of
using a function.


        Stefan




reply via email to

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