unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: Alt as meta, except for certain keys, how?
Date: Tue, 12 Aug 2003 11:14:17 -0600	[thread overview]
Message-ID: <3F392069.1010103@yahoo.com> (raw)
In-Reply-To: qot7k5jxow5.fsf@venus.ling.helsinki.fi

Jussi Piitulainen wrote:

> Kevin Rodgers writes:
>>So you need to use the vector notation for keys containing
>>meta-modified non-ASCII characters:
>>
>>(define-key key-translation-map [?\M- ...] ...)
> 
> M-space? Anyway, that did not seem to work when I tried it. The key
> remained unbound.


Sorry, I was trying to show a general form via ellipses.  A concrete example
would be

(define-key key-translation-map [?\M-7] "|")


>>>Is there a way to turn every valid key code into an
>>>Escape-Meta-Alt-Control-Shift-something? Or can I use a numeric key
>>>code with function-key-map?
>>
>>I don't understand your question.
> 
> I'm sorry. A concrete instance of the first question is this. I'll
> write "letter" for the non-ASCII letters. The following works:
> 
>    (define-key key-translation-map [-134217482] "o")
> 
> I would like to find out a more transparent syntax for that number;
> text-char-description does not do it. Things like [?\M-letter] and
> [?\M- ?letter] and [(meta ?letter)] do not seem to work.


I don't know why those wouldn't work (except that the extra space and
question mark between ?M- and letter in the first form are wrong), unless
there are keyboard/buffer/file coding issues.  You might want to use the
octal encoding instead:

[?\M-\241] 
; meta inverted exclamation point


> For the second question I know the answer now: the following works.
> 
>    (global-unset-key [-134217500])
>    (define-key function-key-map [-134217500] "a")
> 
> I got these numbers by pressing the key I want to bind: Alt-letter,
> where Alt is Meta and letter is outside ASCII. However, ?\M-letter
> evaluates to -134215434 rather than -134217482. If I omit to set
> mac-keyboard-text-encoding to Latin-1, ?\M-letter evaluates to
> -134217574, which is again something else (and the key in question
> cannot be used to produce the letter any more).


I don't understand Emacs' encoding scheme at all, nor do I want to.


> "\M-letter" evaluates to a string that contains just the letter.


The only meta characters that can be included in a string are the meta-

modified ASCII characters:

|    In a string, the 2**7 bit attached to an ASCII character indicates a
| meta character; thus, the meta characters that can fit in a string have
| codes in the range from 128 to 255, and are the meta versions of the
| ordinary ASCII characters.

That's why you have to use the vector notation.


> I think I'll use the numbers for these few keys.

The "Character Type" node of the Emacs Lisp manual strongly discourages that:


|    Since characters are really integers, the printed representation of a
| character is a decimal number.  This is also a possible read syntax for
| a character, but writing characters that way in Lisp programs is a very
| bad idea.  You should _always_ use the special read syntax formats that
| Emacs Lisp provides for characters.  These syntax formats start with a
| question mark.

-- 
Kevin Rodgers

  reply	other threads:[~2003-08-12 17:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-07 17:33 Alt as meta, except for certain keys, how? Jussi Piitulainen
2003-08-07 18:38 ` Kevin Rodgers
2003-08-08  7:05   ` Ehud Karni
     [not found]   ` <mailman.222.1060326618.29551.help-gnu-emacs@gnu.org>
2003-08-08 18:51     ` Kevin Rodgers
2003-08-08 21:26       ` Ehud Karni
     [not found]       ` <mailman.235.1060378027.29551.help-gnu-emacs@gnu.org>
2003-08-11 18:10         ` Jussi Piitulainen
2003-08-11 20:29           ` Kevin Rodgers
2003-08-12  8:26             ` Jussi Piitulainen
2003-08-12 17:14               ` Kevin Rodgers [this message]
2003-08-13  5:14                 ` Jussi Piitulainen
2003-08-15 13:05             ` Kai Großjohann
2003-08-11 19:54         ` Kevin Rodgers
2003-08-12 11:13           ` Ehud Karni
     [not found]           ` <mailman.336.1060687053.29551.help-gnu-emacs@gnu.org>
2003-08-12 18:16             ` Jussi Piitulainen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F392069.1010103@yahoo.com \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).