unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Emacs 21.3, Linux tty:  Meta gets lopped off of C-M-g
@ 2004-03-27  9:24 Alan Mackenzie
  2004-03-28  4:26 ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Mackenzie @ 2004-03-27  9:24 UTC (permalink / raw)


In GNU Emacs 21.3.1 (i686-pc-linux-gnulibc1, X toolkit, Xaw3d scroll bars)
 of 2003-10-25 on acm
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: en_GB
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

At Emacs 21.3 on a Linux tty, something in Emacs's low-level keyboard
handling appears to be mangling the key event C-M-g, silently discarding
the "M-", leaving C-g.  To see this, type C-h c C-M-g.  In the echo area
appears:

C-g runs the command keyboard-quit

This is wrong.  What should appear is:

ESC C-g is undefined

Of the C-M-<english-letter> key presses, the other 25 make it through
Emacs's low-level keyboard processing unscathed.  Only C-M-g doesn't.  For
comparison, on typing C-h c C-M-z, what appears (correctly) is

ESC C-z is undefined

For further comparison, when this Emacs is running under X-Windows,
typing C-M-g correctly causes the following to appear in the echo area:

C-M-g is undefined

-- 
Alan Mackenzie (Munich, Germany)

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

* Re: Emacs 21.3, Linux tty:  Meta gets lopped off of C-M-g
  2004-03-27  9:24 Emacs 21.3, Linux tty: Meta gets lopped off of C-M-g Alan Mackenzie
@ 2004-03-28  4:26 ` Richard Stallman
  2004-03-28  9:39   ` Alan Mackenzie
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2004-03-28  4:26 UTC (permalink / raw)
  Cc: bug-gnu-emacs

    At Emacs 21.3 on a Linux tty, something in Emacs's low-level keyboard
    handling appears to be mangling the key event C-M-g, silently discarding
    the "M-", leaving C-g.

It is converting C-M-g into ESC C-g, but C-g in Emacs is the quit
character.  There is nothing Emacs can do about this.

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

* Re: Emacs 21.3, Linux tty:  Meta gets lopped off of C-M-g
  2004-03-28  4:26 ` Richard Stallman
@ 2004-03-28  9:39   ` Alan Mackenzie
  2004-03-29 20:56     ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Mackenzie @ 2004-03-28  9:39 UTC (permalink / raw)


On Sat, 27 Mar 2004, Richard Stallman wrote:

>    At Emacs 21.3 on a Linux tty, something in Emacs's low-level
>    keyboard handling appears to be mangling the key event C-M-g,
>    silently discarding the "M-", leaving C-g.

>It is converting C-M-g into ESC C-g, .....

It also converts C-M-a int ESC C-a.  Then it looks up ESC in the keymaps,
finds it bound to a keymap itself, looks up C-a in this esc-keymap and
finds `beginning-of-defun'.

However, with C-M-g, things are different.  Emacs apparently says "Even
though the user didn't type C-g, just in case that's what she really
meant, I'd better discard the ESC rather than looking up ESC in a
keymap.".  This is not a Good Thing.

If I manually type ESC C-g, Emacs executes whatever I have bound to
C-M-g.  Emacs does not discard the ESC in this case, and does not
interpret the C-g as a quitting request.

> .... but C-g in Emacs is the quit character.

C-g the _keyboard_ _action_ is for quitting.  ASCII 0x07, C-g the
_character_, should be looked up in the currently active keymaps.  It
seems Emacs is getting confused between these two things.  In particular,
Emacs should never process an ASCII 0x07 which it has itself generated,
as though it were a C-g keyboard action.

> There is nothing Emacs can do about this.

Hey, what's all this with the fairy stories?  ;-)

It's done successfully in X-Windows, which receives the same fundamental
key events that a tty does.

WHY is it necessary to discard ESC from ESC C-g?

I'd very much appreciate somebody telling me where the code is that
translates the raw keyboard input for C-M-<letter> into ESC C-<letter>.
(I've been looking for some hours without finding it).  Presumably it's
within the C code, not the Lisp code.  In keyboard.c, somewhere?

-- 
Alan Mackenzie (Munich, Germany)
acm@muc.de

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

* Re: Emacs 21.3, Linux tty:  Meta gets lopped off of C-M-g
  2004-03-28  9:39   ` Alan Mackenzie
@ 2004-03-29 20:56     ` Richard Stallman
  2004-03-29 22:41       ` Andreas Schwab
  2004-04-01 21:48       ` Alan Mackenzie
  0 siblings, 2 replies; 7+ messages in thread
From: Richard Stallman @ 2004-03-29 20:56 UTC (permalink / raw)
  Cc: bug-gnu-emacs

    WHY is it necessary to discard ESC from ESC C-g?

I don't know, but I don't think Emacs is doing it.
I think it is Linux.

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

* Re: Emacs 21.3, Linux tty:  Meta gets lopped off of C-M-g
  2004-03-29 20:56     ` Richard Stallman
@ 2004-03-29 22:41       ` Andreas Schwab
  2004-04-01 21:48       ` Alan Mackenzie
  1 sibling, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2004-03-29 22:41 UTC (permalink / raw)
  Cc: Alan Mackenzie, bug-gnu-emacs

Richard Stallman <rms@gnu.org> writes:

>     WHY is it necessary to discard ESC from ESC C-g?
>
> I don't know, but I don't think Emacs is doing it.
> I think it is Linux.

I think it depends on whether C-g is typed before or after ESC is read by
Emacs.  C-g is also the intr character of the terminal, and keyboard
signals cause pending input to be discarded, so Emacs will not see the ESC
if the intr character arrives fast enough.  You can substitute ESC with
any other character to see the effect.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, 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] 7+ messages in thread

* Re: Emacs 21.3, Linux tty:  Meta gets lopped off of C-M-g
  2004-03-29 20:56     ` Richard Stallman
  2004-03-29 22:41       ` Andreas Schwab
@ 2004-04-01 21:48       ` Alan Mackenzie
  2004-04-04 16:25         ` Richard Stallman
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Mackenzie @ 2004-04-01 21:48 UTC (permalink / raw)


On Mon, 29 Mar 2004, Richard Stallman wrote:

> [Alan:]   WHY is it necessary to discard ESC from ESC C-g?

>I don't know, but I don't think Emacs is doing it.
>I think it is Linux.

Apologies.  It is indeed Linux's thing.  When one types C-M-g, the Linux
keyboard driver produces the two character sequence 0x19,0x07, i.e.  ESC
C-g.  Presumably under X, this gets converted into C-M-g before Emacs
sees it.

It would be unreasonable in the extreme to expect Emacs to distinguish
between a user typing ESC followed by C-g, and her typing C-M-g.

I have solved the problem for me personally by remapping my keyboard such
that C-M-g now generates "esc [ 3 > g".  For this, I have a handling
function in the function-key-map.

Many thanks for prodding me to look at this more closely!

-- 
Alan Mackenzie (Munich, Germany)
acm@muc.de

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

* Re: Emacs 21.3, Linux tty:  Meta gets lopped off of C-M-g
  2004-04-01 21:48       ` Alan Mackenzie
@ 2004-04-04 16:25         ` Richard Stallman
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2004-04-04 16:25 UTC (permalink / raw)
  Cc: bug-gnu-emacs

    Apologies.  It is indeed Linux's thing.  When one types C-M-g, the Linux
    keyboard driver produces the two character sequence 0x19,0x07, i.e.  ESC
    C-g.  Presumably under X, this gets converted into C-M-g before Emacs
    sees it.

Under X, Linux doesn't handle the event except at the level of each
key's moving up and down.  So it never sees this as C-M-g.  The X
server assembles the event, and sends it to the application as an X event.
So there is no problem.

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

end of thread, other threads:[~2004-04-04 16:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-27  9:24 Emacs 21.3, Linux tty: Meta gets lopped off of C-M-g Alan Mackenzie
2004-03-28  4:26 ` Richard Stallman
2004-03-28  9:39   ` Alan Mackenzie
2004-03-29 20:56     ` Richard Stallman
2004-03-29 22:41       ` Andreas Schwab
2004-04-01 21:48       ` Alan Mackenzie
2004-04-04 16:25         ` Richard Stallman

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