From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Elena Garrulo Newsgroups: gmane.emacs.help Subject: Translating keys Date: Sun, 16 Oct 2005 21:58:11 +0200 Organization: Aioe.org NNTP Server Message-ID: Reply-To: egarrulo@muchomail.com NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1129492951 30112 80.91.229.2 (16 Oct 2005 20:02:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 16 Oct 2005 20:02:31 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 16 22:02:30 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EREhC-0000A9-Nn for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Oct 2005 22:01:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EREhC-00015D-88 for geh-help-gnu-emacs@m.gmane.org; Sun, 16 Oct 2005 16:01:26 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!syros.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!t-online.de!fr.ip.ndsoftware.net!zen.net.uk!dedekind.zen.co.uk!213.155.197.138.MISMATCH!ilaria.aioe.org!aioe.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 21 Original-NNTP-Posting-Host: gHlcE8DaR02PB+7A7167LQ.907.domitilla.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.1) Gecko/20040707 Original-Xref: shelby.stanford.edu gnu.emacs.help:134675 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:30257 Archived-At: 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.