[Top][All Lists]

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

RE: single-key-description no good for Japanese and Chinese chars

From: Drew Adams
Subject: RE: single-key-description no good for Japanese and Chinese chars
Date: Wed, 20 Sep 2006 15:17:16 -0700

    > `single-key-description' returns the exact same key description for
    > each key in the asian character sets (Japanese, Chinese, etc.).
    > For example, for the different input events (keys) 20864 and 20992,
    > the exact same description is given: "Character set JISX0208.1978
    > (Japanese): ISO-IR-42".

    Are there keyboards that produce these keycodes? Or are these
    characters that are the result of an input method?

I don't know. There are lots of keys that my keyboard doesn't have, but they
are nevertheless treated by Emacs OK.

    Or are you just looping,
    potentially feeding single-key-description garbage?

I'm mapping over keymaps with `map-keymap' (using a function that applies
`single-key-description' to the key parts). This includes keys that are
bound to `self-insert-command'. Many of them are keys like `a' and `$', but
many are Chinese etc. keys (characters).

I then convert back the output of `single-key-description', using
`read-kbd-macro', to get back the key. (These two inverse operations are
done in two different contexts.)

    I don't think it is unreasonable for single-key-description to use the
    same description for these many thousands of characters especially if
    they are not produced directly by any keyboard in common use.

I don't know if there is any such keyboard. Even if there is not, they are,
logically, separate "keys" (characters). Nothing prevents an input method
from inputting the character `a' either.

    There is nothing in the documentation that suggests that it
    should generate a unique value for every possible key sequence.

Maybe there is nothing about that in the doc, but doesn't it seem logical?
What's the point of a `single-key-description' that is not a single key
description, but is a description of all of the keys (characters) for a
given character set?

And, as I said, there already is a unique value for each key - the event
number. I suggested appending that to the description, to make each
character "recognizable" (unique). When I run through the debugger, I see
the unique event numbers, but `single-key-description' just throws them away
(ignores them).

However, as I mentioned after my first mail, it seems like whatever is used
for the key (character) description should also be usable as input for the
reverse operation by `read-kbd-macro'. Wouldn't the Chinese (or whatever)
character itself (as a string) be the best value to use as the output of
`single-key-description'? Or can't we have a string with Chinese characters
in it?

Again, I'm no expert on this stuff. I'm just thinking out loud and asking.
I'm thinking that, logically, I should be able to do the same thing with a
Chinese character that I can do with some of the other "strange" characters
that are bound to `self-insert-command'. I see, for instance, lots of
characters that I doubt would be associated with a key from any keyboard -
and they all work OK with my code. They probably belong to ISO-*, but I'm
not sure they're on any keyboard.

reply via email to

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