From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Ehud Karni" Newsgroups: gmane.emacs.help Subject: Re: Alt as meta, except for certain keys, how? Date: Fri, 8 Aug 2003 10:05:49 +0300 Organization: Mivtach-Simon Insurance agencies Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <200308080705.h7875nTk030718@beta.mvs.co.il> References: <3F329CBE.8050706@yahoo.com> Reply-To: ehud@unix.mvs.co.il NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-8-i Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1060326652 19100 80.91.224.253 (8 Aug 2003 07:10:52 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 8 Aug 2003 07:10:52 +0000 (UTC) Cc: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 08 09:11:16 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 19l1PA-0008Q5-00 for ; Fri, 08 Aug 2003 09:11:16 +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 19l1OO-0002OH-1t for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Aug 2003 03:10:28 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19l1OC-0002NO-JE for help-gnu-emacs@gnu.org; Fri, 08 Aug 2003 03:10:16 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19l1Ng-000284-S7 for help-gnu-emacs@gnu.org; Fri, 08 Aug 2003 03:10:15 -0400 Original-Received: from [192.114.178.12] (helo=unix.mvs.co.il) by monty-python.gnu.org with esmtp (Exim 4.20) id 19l1LC-0000Xz-Fj for help-gnu-emacs@gnu.org; Fri, 08 Aug 2003 03:07:10 -0400 Original-Received: from beta.mvs.co.il (beta [10.253.0.3]) by unix.mvs.co.il (8.11.6/8.11.6) with ESMTP id h7875qb31467; Fri, 8 Aug 2003 10:05:52 +0300 Original-Received: from beta.mvs.co.il (localhost [127.0.0.1]) by beta.mvs.co.il (8.12.5/8.12.5) with ESMTP id h7875oBD030724; Fri, 8 Aug 2003 10:05:50 +0300 Original-Received: (from root@localhost) by beta.mvs.co.il (8.12.5/8.12.5/Submit) id h7875nTk030718; Fri, 8 Aug 2003 10:05:49 +0300 Original-To: "Jussi Piitulainen" , " Kevin Rodgers" In-reply-to: <3F329CBE.8050706@yahoo.com> (message from Kevin Rodgers on Thu, 07 Aug 2003 12:38:54 -0600) X-Mailer: Emacs 21.3.1 rmail (send-msg 1.108) 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:11663 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:11663 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thu, 07 Aug 2003 12:38:54 -0600, Kevin Rodgers wrote: > > Jussi Piitulainen wrote: > > > I want to use Alt as a Meta key, with the exception that certain keys > > should be interpreted as ordinary unmodified characters: Alt-7 should > > produce vertical bar |, Shift-Alt-7 alias Alt-/ should produce > > backslash \, and there are a few others, all in ASCII. > > > > I have managed to (global-set-key "\M-7" "|"). That works for writing > > but is not a real solution. At least in an incremental search Alt-7 > > has already been interpreted as two keys: the escape terminates the > > search and 7 is inserted in the buffer. > > > Try setting search-exit-option to nil. > > > > I could not work out how to use keyboard-translate to turn Alt-7 into > > vertical bar. If this is possible, could someone please show me the > > concrete command? Or any other way to achieve my goal? > > > (keyboard-translate ?\M-7 ?|) doesn't work, because keyboard-translate-table > is a char-table, which only handles unmodified characters. You can find the character value of any key by the following function: (defun get-char-value () "get decimal value of any key" (interactive) (let (char desc) (message "Type any char - " ) (setq char (read-event)) (if (not char) (message "Non char event - no value") (condition-case () (setq desc (text-char-description char)) (error (setq desc "(No description)"))) (if (numberp char) (message "Character typed is %s, (octal=%03o, decimal=%d, hexa=%02x)" desc char char char) (message "Input typed is %s, not a number" (prin1-to-string char t)))))) On my system it shows for Alt-7: Character typed is "7", (octal=20000067, decimal=4194359, hexa=400037) So if you do: (define-key key-translation-map [4194359] "|") It will do what you want (in all modes and maps - including isearch). 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)) Ehud. - -- Ehud Karni Tel: +972-3-7966-561 /"\ Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign Insurance agencies (USA) voice mail and X Against HTML Mail http://www.mvs.co.il FAX: 1-815-5509341 / \ mailto:ehud@unix.mvs.co.il Better Safe Than Sorry -----BEGIN PGP SIGNATURE----- Comment: use http://www.keyserver.net/ to get my key (and others) iD8DBQE/M0vLLFvTvpjqOY0RAhX+AJ9LHeuuOApGdN3Bm7w4JQyZHjlrUACfSxfp GuDiPrO+dSD2WK1otk5mPAY= =KJMF -----END PGP SIGNATURE-----