[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: kbd vs read-key-sequence
From: |
Stefan Monnier |
Subject: |
Re: kbd vs read-key-sequence |
Date: |
Mon, 05 Mar 2007 12:10:00 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux) |
> On the other side of the problem we have code written in the .emacs
> file which tries to bind something to this key. To work, this has to
> satisfy the condition that when Emacs loads the .emacs file, the key
> it finds in the define-key call corresponds to the form of the event
> after key-translation-map (but before unibyte-char-to-multibyte if
> applicable).
> Except for the case of unibyte characters, that is the same as the
> character that gets inserted in the buffer if you type the character,
> right? So it should be possible to type in the character code that
> C-x = shows you, right?
Almost:
1 - the unibyte case is very common, so the "exception" is important.
2 - there's also translation-table-for-input. I had suggested to apply this
directly in read-char but it was rejected, so it's still applied much
later, in self-insert-command (and a few other commands).
> And you should also be able to insert that character in .emacs,
> then save it in whichever coding system. Why won't that work?
Off the top of my head:
- saving may change the char thanks to unify-8859-on-encoding
(e.g. you copy a iso-8859-15 char to your .emacs which you then save in
iso-8859-1).
- the coding-system may not be properly detected, especially if you
configure your auto-dtection in your .emacs: the configuration will apply
to all files you open but not to the loading of .emacs
> And if you want it to work with modifiers, it's yet a bit more
> interesting because the base-event is not always decoded
> I don't understand that. What does it mean to "decode the base-event"?
Turn ?\M-<encoded-é> into ?\M-é.
> Anyway, if you want to bind a character with modifiers, you can just use
> a construct in .emacs that applies the modifier to the desired base
> character, such as \M- in a string, or (meta CHAR).
> Is there a case where that doesn't work?
Because the way the event is decoded through read-key-sequence is not
necessarily the same. E.g. while ?<encoded-é> may get turned into ?é, it
may be the case that ?\M-<encoded-é> stays unchanged.
Stefan
- Re: kbd vs read-key-sequence, (continued)
- Re: kbd vs read-key-sequence, Stefan Monnier, 2007/03/02
- Re: kbd vs read-key-sequence, Juanma Barranquero, 2007/03/02
- Re: kbd vs read-key-sequence, Jason Rumney, 2007/03/02
- Re: kbd vs read-key-sequence, Juanma Barranquero, 2007/03/02
- Re: kbd vs read-key-sequence, David Kastrup, 2007/03/02
- Re: kbd vs read-key-sequence, Stefan Monnier, 2007/03/02
- Re: kbd vs read-key-sequence, Juanma Barranquero, 2007/03/02
- Re: kbd vs read-key-sequence, Richard Stallman, 2007/03/03
- Re: kbd vs read-key-sequence, Stefan Monnier, 2007/03/03
- Re: kbd vs read-key-sequence, Richard Stallman, 2007/03/04
- Re: kbd vs read-key-sequence,
Stefan Monnier <=
- Re: kbd vs read-key-sequence, Richard Stallman, 2007/03/11
- Re: kbd vs read-key-sequence, Stefan Monnier, 2007/03/12
- Re: kbd vs read-key-sequence, Kenichi Handa, 2007/03/12
- Re: kbd vs read-key-sequence, Stefan Monnier, 2007/03/12
- Re: kbd vs read-key-sequence, Kenichi Handa, 2007/03/13
- Re: kbd vs read-key-sequence, Stefan Monnier, 2007/03/13
- Re: kbd vs read-key-sequence, Richard Stallman, 2007/03/19
- Re: kbd vs read-key-sequence, Kenichi Handa, 2007/03/19
- Re: kbd vs read-key-sequence, Kim F. Storm, 2007/03/19
- Re: kbd vs read-key-sequence, Richard Stallman, 2007/03/25