help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Translating keys


From: Stefan Monnier
Subject: Re: Translating keys
Date: Sun, 16 Oct 2005 23:03:01 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> (local-set-key "ò" (lambda () (interactive) (insert "{")))
> but it doesn't work.
> I think I should know the code generated by the key. Is there a way?

There are many different ò.  And the one sent by your keyboard's key is not
always the same depending on the version of Emacs, and the one read from
your .emacs is not always the same either depending on your locale, your
Emacs settings and maybe a -*- coding -*- cookie in the file.

Try M-: (read-event) RET and then hit your ò key.  It'll return the code
Elisp receives in response to this key (e.g. 2290).  You can then bind it
with (local-set-key [2290] "{").

> Anyway, the "insert" function is not useful, because the generated character
> does not behave like the original one (I've electric C enabled and the
> { generated by "insert" is not recognized as electric; the original { is).

Try (local-set-key "ò" "{").  The "{" part is a keyboard macro which tells
Emacs to behave as if you had typed the key sequence "{" (i.e. composed of
a single key).


        Stefan


reply via email to

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