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

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

Re: Help producing the Alt modifier


From: Kai Großjohann
Subject: Re: Help producing the Alt modifier
Date: Thu, 01 May 2003 13:47:39 +0200
User-agent: Gnus/5.09002 (Oort Gnus v0.20) Emacs/21.3.50 (gnu/linux)

Jeremy Bowen <address@hidden> writes:

> Kai Großjohann wrote:
>> What happens when you do this?
>> 
>> (global-set-key (kbd "<escape> a") 'forward-char)
>> (global-set-key (kbd "M-a") 'backward-char)
>
> It seems that ESC actually gives me ESC which is then interpreted as Meta as 
> it should be according to the docs.

Did you actually try it?

I just did "emacs -q -no-site-file", then evaled the above
expressions, then tested them.  And ESC a and M-a did different
things!

However, it only works in a window system where Emacs knows the
difference between <escape> and ESC.  These are actually different
things, though Emacs tries hard to make them behave the same.  Here's
the story:

In the old days, there were only ascii terminals, so special function
keys like ESC and RET and TAB were assigned ascii codes (27 and 13
and 9).  And the system could not distinguish ESC from Ctrl-[, nor
RET from Ctrl-M, nor TAB from Ctrl-I.

But now we have real function keys.  But to preserve the old
behavior, whereby C-m and RET always did the same thing, as did TAB
and C-i and ESC and C-[, function-key-map was invented.  It
translates <escape> into ESC (which is the same as C-[).  There is
also additional magic that makes M-x be the same as ESC x, but I
don't know how that works.  It's different magic, I think.

By explicitly binding <escape>, the automatic translation from
<escape> to ESC (via function-key-map) is shadowed.

-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)


reply via email to

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