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

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

Translating keys


From: Elena Garrulo
Subject: Translating keys
Date: Sun, 16 Oct 2005 21:58:11 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.1) Gecko/20040707

Hello,

I'd like to translate some keys in a mode dependent way. For example, when in c-mode, the key which prints "ò" should print "{"; when in text-mode should print the original character. Since the translation should be mode dependent, keyboard-translate is not a viable option. I've tried:

(local-set-key "ò" (lambda () (interactive) (insert "{")))

but it doesn't work. It works with other keys, for example:

(local-set-key "a" (lambda () (interactive) (insert "{")))

I think I should know the code generated by the key. Is there a way?

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

Any help?

Thanks.


reply via email to

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