Subject: 24.4; delete-frame suspends tty when running emacs on virtual terminal

From: Daniel McClanahan <[email-masked]>
Date: Mon, 3 Nov 2014 01:07:07 -0600

When delete-frame is called, emacs eventually runs the function
server-delete-client, defined in server.el. In server.el, there is an unless
clause stating in the comments "Delete the client's tty, except on
Windows". This assumes that if the user is using emacs with multiple frames,
those separate frames are running in separate ttys. However, when I
typically
use emacs in multiple frames, those multiple frames are simply in separate
virtual terminals within an X session. As a result, this behavior (deleting
the
tty) is vexing for me, since it makes closing a frame also crash emacs,
which is
running in the same tty (the tty is suspended and when unsuspended with fg,
emacs displays text entered literally (^X and the like are displayed, for
example), but does not respond to M-x or other keybindings).

Obviously, this does not occur (I've checked) if:
1) Emacs is running graphically.
2) Emacs is running in gdb.

To make this occur:
1) Run emacs -nw in a virtual terminal window and start server.
2) Run emacsclient -nw in another virtual terminal.
3) Run delete-frame on the client and observe the behavior in the original
emacs
terminal window.

When I commented out that unless clause and rebuilt emacs the behavior
disappears, so I'm confident I've correctly diagnosed the issue. I've
created a
defcustom in my local version of the development bzr branch of server.el to
allow the user to specify whether this behavior should occur, defaulting to
nil
which enables the current behavior. Would sending a patch of this be
acceptable,
or does the project wish to simply continue the current behavior of
server-delete-client?