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

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

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


From: Stefan Monnier
Subject: Re: single-key-description no good for Japanese and Chinese chars
Date: Fri, 22 Sep 2006 20:31:49 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> Except for these "invalid" keys, you can use `read-kbd-macro' and call
> `self-insert-command' on a key from `map-keymaps' to insert it (after
> setting `last-command-char').

The fact that it works in most other cases is just accidental.

>     I see no relation between self-insert-command and the other two.

> See above. I think that Handa explained that you cannot use
> `self-insert-command' to insert such keys,

You can't "insert" it, no matter what: it's not a character.

> And I would like to be able to pick up a key from `map-keymaps' and
> execute its command (binding).

OK, so that's your motivation.  It would help to say it upfront.
Now, if you tell us the larger reason why you want to do this, we may be
able to help you figure out how to do it.

> I would expect command `self-command-insert' to insert the key, and that
> doesn't work for the "invalid" keys.

You can't insert a key, you can only insert a char.  Some keys can be turned
(more or less trivially) into chars, but not all.

>> A program might well expect `self-insert-command' to do what it says
>> straightforwardly: insert the key as a character.
>     What makes you think it doesn't do exactly that?
> See above, and Handa's comment that "it doesn't work, it signals an error."

It can't do it because it's an impossible request.  self-insert-command
can't be blamed for it, and no other implementation will solve your problem.

> And I tried it, and it didn't work for me: get the key via `map-keymap', get
> its `single-key-description', get `read-kbd-macro' of that, set
> `last-command-char' to that, and call `self-insert-command'. OK for all keys
> except these "invalid" keys. Seems like a reasonable operation to expect you
> could do, no?

No.  Try your code with the following map:

     (let ((map (make-sparse-keymap)))
       (define-key map [t] 'self-insert-command)
       (define-key map [remap tab-to-tab-stop] 'self-insert-command)
       ...)

and you'll see other instances of the similar problem: self-insert-command
may be bound to chars in indirect ways.  Generic chars are just one such
case among others.


        Stefan




reply via email to

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