[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, 12 Mar 2007 11:19:19 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux)

>     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).

> Is there a procedure we can recommend for the user to avoid this?

I guess "only ever use one and only one encoding".  E.g. don't mix latin-1
and latin-9.
 "use utf-8" or better yet "use emacs-unicode")
(although, maybe utf-8 won't solve it all either, because we may end up with
similar problem where one side uses the single char é while the other uses
a composed "e" and "'").

>     - 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

> Can you avoid this by specifying the coding-system explicitly in .emacs?
> We could recommend that users do so.

Yes, with -*- coding -*-.  It should also work correctly as long as they
*don't* specify the encoding via elisp code in their .emacs (with calls to
set-language-environment, for example).

>> 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.

> How does that happen?

See the OP.  It seems that encoded-kb.el has such a limitation (it should
probably be considered as a bug, but there may be good reasons for it,
I don't know).

> Maybe that is a bug; if so, we should fix it.

That's what this thread is about supposedly.

> We could recommend that people write (meta ?<encoded-?>).
> That would eliminate this particular problem, right?

No.  It would make it work on those systems which have the bug (e.g. w32
right now), but would not work on systems where read-key-sequence correctly
decodes such a key-combination into ?\M-é.

> These do not make things perfect, but I think they might be enough
> to enable users to get reliable results.  What do you think?

I don't think it'll really be reliable, but we can definitely provide
guidelines and hints.


reply via email to

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