From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Alt as meta, except for certain keys, how? Date: Mon, 11 Aug 2003 13:54:09 -0600 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <3F37F461.3030109@yahoo.com> References: <3F329CBE.8050706@yahoo.com> <3F33F14F.2060903@yahoo.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-8-I; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1060632167 30743 80.91.224.253 (11 Aug 2003 20:02:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 11 Aug 2003 20:02:47 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 11 22:02:46 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19mIsQ-000692-00 for ; Mon, 11 Aug 2003 22:02:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19mIqW-0005I7-Nf for geh-help-gnu-emacs@m.gmane.org; Mon, 11 Aug 2003 16:00:48 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!170.207.51.80!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 62 Original-NNTP-Posting-Host: 170.207.51.80 Original-X-Trace: news.uni-berlin.de 1060631648 33295029 170.207.51.80 (16 [82742]) User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us Original-Xref: shelby.stanford.edu gnu.emacs.help:115811 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:11729 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11729 Ehud Karni wrote: >On Fri, 08 Aug 2003 12:51:59 -0600, Kevin Rodgers wrote: >>Ehud Karni wrote: >>>On my system it shows for Alt-7: >>> Character typed is "7", (octal=20000067, decimal=4194359, hexa=400037) >> >>Just evaluate ?\M-7. On my system, it is -134217673, which is the crux of the >>problem: meta-modified characters may have a negative character code, and thus >>may not be a valid index into a char-table. >> > > I did evaluate ?\M-7 and I get the same result (-134217673) as you. > It is NOT what my function returns (4194359) !!! Hmmm, here's what I get: Character typed is (No description), (octal=37000000067, decimal=-134217673, hexa=f8000037) >>>So if you do: >>> (define-key key-translation-map [4194359] "|") >> >>key-translation-map takes character arguments, not (vector or string) keys: > > Not true, see below. ... >>>Because key-translation-map may not exist, you better protect yourself >>>by adding the following (before the define-key command): >>> (if (not key-translation-map) >>> (make-sparse-keymap key-translation-map)) >>> >>key-translation-map is now a char-table, not a keymap (see the Translating Input >>node of the Emacs Lisp manual). > > I don't know which Emacs are you using, I checked it on 21.2, 21.3. and > 21.3.50 (CVS HEAD version). On all the documentation for ` > key-translation-map' says: > > Keymap of key translations that can override keymaps. > This keymap works like `function-key-map', but comes after that, > and applies even for keys that have ordinary bindings. > > I think you confuse it with `keyboard-translate-table' which is > used/created by the `keyboard-translate' command. Ah, you're correct of course! Sorry about that. But the manual says that "The intent of `key-translation-map' is for users to map one character set to another", so doesn't this count as abuse (rather than use) of that feature? It seems odd to me -- backwards, even -- that keyboard-translate-table can't handle all the events (such as meta-modified characters) that the keyboard can generate, but that key-translation-map can (even though it is intended to map only characters). -- Kevin Rodgers