unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* M-<function-key> vs. ESC <function-key>
@ 2005-01-03 15:16 Andreas Schwab
  2005-01-04  3:36 ` Richard Stallman
  0 siblings, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2005-01-03 15:16 UTC (permalink / raw)


There doesn't seem to be a translation between M-<function-key> and ESC
<function-key> for the purpose of keymap lookup.  For example, bindings.el
binds [M-left], which works for X, but on a text terminal the keypress
Alt-left is received (after translation through function-key-map) as [?\e
left] which is not bound.  Shouldn't [M-left] and [?\e left] be treated as
equivalent keys?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-03 15:16 M-<function-key> vs. ESC <function-key> Andreas Schwab
@ 2005-01-04  3:36 ` Richard Stallman
  2005-01-04 12:01   ` Lennart Borgman
  2005-01-04 13:02   ` Andreas Schwab
  0 siblings, 2 replies; 17+ messages in thread
From: Richard Stallman @ 2005-01-04  3:36 UTC (permalink / raw)
  Cc: emacs-devel

    There doesn't seem to be a translation between M-<function-key> and ESC
    <function-key> for the purpose of keymap lookup.

That is true, but I don't think it is a problem.

The equivalence of ESC and M- for characters is rather a kludge,
and perhaps some day we should reimplement that by implementing ESC
in some other way as an abbreviation for Meta-.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-04  3:36 ` Richard Stallman
@ 2005-01-04 12:01   ` Lennart Borgman
  2005-01-05  3:31     ` Richard Stallman
  2005-01-04 13:02   ` Andreas Schwab
  1 sibling, 1 reply; 17+ messages in thread
From: Lennart Borgman @ 2005-01-04 12:01 UTC (permalink / raw)
  Cc: emacs-devel

----- Original Message ----- 
From: "Richard Stallman" <rms@gnu.org>

..
> The equivalence of ESC and M- for characters is rather a kludge,
> and perhaps some day we should reimplement that by implementing ESC
> in some other way as an abbreviation for Meta-.

Would no that break viper?

- Lennart

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-04  3:36 ` Richard Stallman
  2005-01-04 12:01   ` Lennart Borgman
@ 2005-01-04 13:02   ` Andreas Schwab
  2005-01-05  3:31     ` Richard Stallman
  1 sibling, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2005-01-04 13:02 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     There doesn't seem to be a translation between M-<function-key> and ESC
>     <function-key> for the purpose of keymap lookup.
>
> That is true, but I don't think it is a problem.

IMHO it is.  Currently you need to bind both M-<func> and ESC <func> to be
effective for both tty and X (including keyboards without a Meta
modifier).  This problem does not exist for S-<func> and C-<func> bindings
as long as they can be generated on a tty in the first place.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-04 12:01   ` Lennart Borgman
@ 2005-01-05  3:31     ` Richard Stallman
  0 siblings, 0 replies; 17+ messages in thread
From: Richard Stallman @ 2005-01-05  3:31 UTC (permalink / raw)
  Cc: schwab, emacs-devel

    > The equivalence of ESC and M- for characters is rather a kludge,
    > and perhaps some day we should reimplement that by implementing ESC
    > in some other way as an abbreviation for Meta-.

    Would no that break viper?

I have no idea what viper does.  Is there a specific reason why you
think it would break?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-04 13:02   ` Andreas Schwab
@ 2005-01-05  3:31     ` Richard Stallman
  2005-01-05 19:43       ` Andreas Schwab
  0 siblings, 1 reply; 17+ messages in thread
From: Richard Stallman @ 2005-01-05  3:31 UTC (permalink / raw)
  Cc: emacs-devel

    >     There doesn't seem to be a translation between M-<function-key> and ESC
    >     <function-key> for the purpose of keymap lookup.
    >
    > That is true, but I don't think it is a problem.

    IMHO it is.  Currently you need to bind both M-<func> and ESC <func> to be
    effective for both tty and X (including keyboards without a Meta
    modifier).

Emacs doesn't treat ESC followed by a function key as equivalent to
Meta, so I don't think you need to bind the former at all.

I agree, as I said, that it would be better if Meta worked more
like Control- and so on.  I just don't think it is urgent.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-05  3:31     ` Richard Stallman
@ 2005-01-05 19:43       ` Andreas Schwab
  2005-01-06  4:54         ` Richard Stallman
  0 siblings, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2005-01-05 19:43 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     >     There doesn't seem to be a translation between M-<function-key> and ESC
>     >     <function-key> for the purpose of keymap lookup.
>     >
>     > That is true, but I don't think it is a problem.
>
>     IMHO it is.  Currently you need to bind both M-<func> and ESC <func> to be
>     effective for both tty and X (including keyboards without a Meta
>     modifier).
>
> Emacs doesn't treat ESC followed by a function key as equivalent to
> Meta, so I don't think you need to bind the former at all.

Yes, I do, because that's what Emacs is receiving when I press Meta-left,
for example.  More specifically, when I type Meta-left at Emacs running in
xterm it receives the key sequence [?\e ?\e ?O ?D], which gets translated
to [?\e left] through function-key-map.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-05 19:43       ` Andreas Schwab
@ 2005-01-06  4:54         ` Richard Stallman
  2005-01-06 12:16           ` Andreas Schwab
  2005-01-06 16:14           ` David Kastrup
  0 siblings, 2 replies; 17+ messages in thread
From: Richard Stallman @ 2005-01-06  4:54 UTC (permalink / raw)
  Cc: emacs-devel

    Yes, I do, because that's what Emacs is receiving when I press Meta-left,
    for example.  More specifically, when I type Meta-left at Emacs running in
    xterm it receives the key sequence [?\e ?\e ?O ?D], which gets translated
    to [?\e left] through function-key-map.

That is a surprise to me.  Someone must have changed this in recent
years.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-06  4:54         ` Richard Stallman
@ 2005-01-06 12:16           ` Andreas Schwab
  2005-01-07  2:49             ` Richard Stallman
  2005-01-06 16:14           ` David Kastrup
  1 sibling, 1 reply; 17+ messages in thread
From: Andreas Schwab @ 2005-01-06 12:16 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     Yes, I do, because that's what Emacs is receiving when I press Meta-left,
>     for example.  More specifically, when I type Meta-left at Emacs running in
>     xterm it receives the key sequence [?\e ?\e ?O ?D], which gets translated
>     to [?\e left] through function-key-map.
>
> That is a surprise to me.  Someone must have changed this in recent
> years.

In which way?  What is the expected behaviour?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-06  4:54         ` Richard Stallman
  2005-01-06 12:16           ` Andreas Schwab
@ 2005-01-06 16:14           ` David Kastrup
  2005-01-06 17:36             ` Stefan Monnier
  1 sibling, 1 reply; 17+ messages in thread
From: David Kastrup @ 2005-01-06 16:14 UTC (permalink / raw)
  Cc: Andreas Schwab, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     Yes, I do, because that's what Emacs is receiving when I press
>     Meta-left, for example.  More specifically, when I type
>     Meta-left at Emacs running in xterm it receives the key sequence
>     [?\e ?\e ?O ?D], which gets translated to [?\e left] through
>     function-key-map.
>
> That is a surprise to me.  Someone must have changed this in recent
> years.

He did not say what his input terminal is.  It may not be X.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-06 16:14           ` David Kastrup
@ 2005-01-06 17:36             ` Stefan Monnier
  2005-01-06 18:03               ` David Kastrup
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Monnier @ 2005-01-06 17:36 UTC (permalink / raw)
  Cc: Andreas Schwab, rms, emacs-devel

>> Yes, I do, because that's what Emacs is receiving when I press
>> Meta-left, for example.  More specifically, when I type
>> Meta-left at Emacs running in xterm it receives the key sequence
>> [?\e ?\e ?O ?D], which gets translated to [?\e left] through
>> function-key-map.
>> 
>> That is a surprise to me.  Someone must have changed this in recent
>> years.

> He did not say what his input terminal is.  It may not be X.

He said it's an xterm.  I see the same behavior as he does.
It's been that way for as long as I can remember (the Meta->ESC mapping
done by xterm is an option, which needs to be ON if you want 8bit chars).


        Stefan

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-06 17:36             ` Stefan Monnier
@ 2005-01-06 18:03               ` David Kastrup
  2005-01-06 18:30                 ` Stefan Monnier
  0 siblings, 1 reply; 17+ messages in thread
From: David Kastrup @ 2005-01-06 18:03 UTC (permalink / raw)
  Cc: Andreas Schwab, rms, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> Yes, I do, because that's what Emacs is receiving when I press
>>> Meta-left, for example.  More specifically, when I type
>>> Meta-left at Emacs running in xterm it receives the key sequence
>>> [?\e ?\e ?O ?D], which gets translated to [?\e left] through
>>> function-key-map.
>>> 
>>> That is a surprise to me.  Someone must have changed this in recent
>>> years.
>
>> He did not say what his input terminal is.  It may not be X.
>
> He said it's an xterm.

Which is not X.  So Emacs never gets to see Meta.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-06 18:03               ` David Kastrup
@ 2005-01-06 18:30                 ` Stefan Monnier
  2005-01-06 19:20                   ` David Kastrup
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Monnier @ 2005-01-06 18:30 UTC (permalink / raw)
  Cc: Andreas Schwab, rms, emacs-devel

>>>> Yes, I do, because that's what Emacs is receiving when I press
>>>> Meta-left, for example.  More specifically, when I type
>>>> Meta-left at Emacs running in xterm it receives the key sequence
>>>> [?\e ?\e ?O ?D], which gets translated to [?\e left] through
>>>> function-key-map.
>>>> 
>>>> That is a surprise to me.  Someone must have changed this in recent
>>>> years.
>> 
>>> He did not say what his input terminal is.  It may not be X.
>> 
>> He said it's an xterm.

> Which is not X.  So Emacs never gets to see Meta.

Please re-read: he presses M-left, which xterm turns into [?\e ?\e ?O ?D]
and which function-key-map transforms to [?\e left] and the lookup with
[?\e left] fails to find the M-left binding to backward-word.

In contrast, M-C-f is turned by xterm into [?\e ?\C-f] which
function-key-map leaves alone and the lookup for [?\e ?\C-f] successfully
finds the M-C-f binding to forward-sexp.


        Stefan

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-06 18:30                 ` Stefan Monnier
@ 2005-01-06 19:20                   ` David Kastrup
  0 siblings, 0 replies; 17+ messages in thread
From: David Kastrup @ 2005-01-06 19:20 UTC (permalink / raw)
  Cc: Andreas Schwab, rms, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>>>> Yes, I do, because that's what Emacs is receiving when I press
>>>>> Meta-left, for example.  More specifically, when I type
>>>>> Meta-left at Emacs running in xterm it receives the key sequence
>>>>> [?\e ?\e ?O ?D], which gets translated to [?\e left] through
>>>>> function-key-map.
>>>>> 
>>>>> That is a surprise to me.  Someone must have changed this in recent
>>>>> years.
>>> 
>>>> He did not say what his input terminal is.  It may not be X.
>>> 
>>> He said it's an xterm.
>
>> Which is not X.  So Emacs never gets to see Meta.
>
> Please re-read: he presses M-left, which xterm turns into [?\e ?\e
> ?O ?D] and which function-key-map transforms to [?\e left] and the
> lookup with [?\e left] fails to find the M-left binding to
> backward-word.
>
> In contrast, M-C-f is turned by xterm into [?\e ?\C-f] which
> function-key-map leaves alone and the lookup for [?\e ?\C-f]
> successfully finds the M-C-f binding to forward-sexp.

I should work on my attention span.  I even quoted the relevant
passage.  And contributed complete nonsense.  As a kind of excuse, I
have had net access only in the mniddle of the night in the last few
days, and my niece (where I have been visiting) tended to wake me up
at 8am, so the time for sleeping has been in short supply.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-06 12:16           ` Andreas Schwab
@ 2005-01-07  2:49             ` Richard Stallman
  2005-01-07  6:36               ` Miles Bader
  2005-01-07 13:14               ` Andreas Schwab
  0 siblings, 2 replies; 17+ messages in thread
From: Richard Stallman @ 2005-01-07  2:49 UTC (permalink / raw)
  Cc: emacs-devel

      More specifically, when I type Meta-left at Emacs running in
    >     xterm it receives the key sequence [?\e ?\e ?O ?D], which gets translated
    >     to [?\e left] through function-key-map.
    >
    > That is a surprise to me.  Someone must have changed this in recent
    > years.

    In which way?  What is the expected behaviour?

That Meta-left turns into ESC left is strange.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-07  2:49             ` Richard Stallman
@ 2005-01-07  6:36               ` Miles Bader
  2005-01-07 13:14               ` Andreas Schwab
  1 sibling, 0 replies; 17+ messages in thread
From: Miles Bader @ 2005-01-07  6:36 UTC (permalink / raw)
  Cc: Andreas Schwab, emacs-devel

Richard Stallman <rms@gnu.org> writes:
>     >     More specifically, when I type Meta-left at Emacs running in
>     >     xterm it receives the key sequence [?\e ?\e ?O ?D], which
>     >     gets translated to [?\e left] through function-key-map.
>
>     In which way?  What is the expected behaviour?
>
> That Meta-left turns into ESC left is strange.

What other character-sequence should xterm send?  I guess it can set the
high bit for meta-fied single-character keys, but it's a bit unclear
what it should do for keys that send escape sequences, so prepending an
ESC seems as good as anything...

Maybe emacs ought to directly handle such "ESC ESC ..." sequences as
independent function key bindings, since it really seems like that's
what they are; e.g., add the translation ("ESC ESC O D" -> [\M-left]) to
function-key-map.

-Miles
-- 
We are all lying in the gutter, but some of us are looking at the stars.
-Oscar Wilde

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: M-<function-key> vs. ESC <function-key>
  2005-01-07  2:49             ` Richard Stallman
  2005-01-07  6:36               ` Miles Bader
@ 2005-01-07 13:14               ` Andreas Schwab
  1 sibling, 0 replies; 17+ messages in thread
From: Andreas Schwab @ 2005-01-07 13:14 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>       More specifically, when I type Meta-left at Emacs running in
>     >     xterm it receives the key sequence [?\e ?\e ?O ?D], which gets translated
>     >     to [?\e left] through function-key-map.
>     >
>     > That is a surprise to me.  Someone must have changed this in recent
>     > years.
>
>     In which way?  What is the expected behaviour?
>
> That Meta-left turns into ESC left is strange.

As Stefan already explained this is an option in xterm.  If you want to
handle 8-bit character input (including, but not limited to UTF-8) this is
required.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2005-01-07 13:14 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-03 15:16 M-<function-key> vs. ESC <function-key> Andreas Schwab
2005-01-04  3:36 ` Richard Stallman
2005-01-04 12:01   ` Lennart Borgman
2005-01-05  3:31     ` Richard Stallman
2005-01-04 13:02   ` Andreas Schwab
2005-01-05  3:31     ` Richard Stallman
2005-01-05 19:43       ` Andreas Schwab
2005-01-06  4:54         ` Richard Stallman
2005-01-06 12:16           ` Andreas Schwab
2005-01-07  2:49             ` Richard Stallman
2005-01-07  6:36               ` Miles Bader
2005-01-07 13:14               ` Andreas Schwab
2005-01-06 16:14           ` David Kastrup
2005-01-06 17:36             ` Stefan Monnier
2005-01-06 18:03               ` David Kastrup
2005-01-06 18:30                 ` Stefan Monnier
2005-01-06 19:20                   ` David Kastrup

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).