Commit 8303ba32 authored by Karoly Lorentey's avatar Karoly Lorentey

Implemented automatic deletion of terminals.

lisp/server.el (server-process-filter): Switch to the new terminal frame.

src/frame.c (Fdelete_frame): Delete the tty if this was its the last frame.

git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-12
parent bc279d67
......@@ -180,6 +180,11 @@ DIARY OF CHANGES
initialization. There is a memory corruption error around this
somewhere.)
-- Implement automatic deletion of terminals when the last frame on
that terminal is closed.
(Done.)
THINGS TO DO
------------
......@@ -200,16 +205,16 @@ THINGS TO DO
Update: yes it does, although it is much rarer. Or maybe it's
another bug.
** C-g should work on secondary terminals.
** Change emacsclient/server.el to support the -h argument better,
i.e. automatically close the socket when the frame is closed.
** Implement automatic deletion of terminals when the last frame on
that terminal is closed.
** Export delete_tty to the Lisp environment, for emacsclient.
** C-g should work on secondary terminals.
** Make parts of struct tty_output accessible from Lisp. The device
name and the type is sufficient.
** Export delete_tty to the Lisp environment, for emacsclient.
** Implement support for starting an interactive Emacs session without
an initial frame. (The user would connect to it and open frames
later, with emacsclient.) Not necessarily a good idea.
......
......@@ -325,9 +325,9 @@ PROC is the server process. Format of STRING is \"PATH PATH PATH... \\n\"."
(type (server-unquote-arg (match-string 2 request))))
(setq request (substring request (match-end 0)))
(condition-case err
(progn
(make-terminal-frame `((tty . ,pty) (tty-type . ,type)))
(process-send-string proc (concat (number-to-string (emacs-pid)) "\n")))
(let ((frame (make-terminal-frame `((tty . ,pty) (tty-type . ,type)))))
(process-send-string proc (concat (number-to-string (emacs-pid)) "\n"))
(select-frame frame))
(error (process-send-string proc (nth 1 err))
(setq request "")))))
;; ARG is a line number option.
......
......@@ -1381,6 +1381,26 @@ The functions are run with one arg, the frame to be deleted. */)
x_destroy_window (f);
#endif
if (FRAME_TERMCAP_P (f))
{
/* See if the terminal needs to be closed. */
Lisp_Object tail, frame1;
int delete = 1;
FOR_EACH_FRAME (tail, frame1)
{
if (!FRAME_LIVE_P (XFRAME (frame1)) &&
FRAME_TERMCAP_P (XFRAME (frame1)) &&
FRAME_TTY (XFRAME (frame1)) == FRAME_TTY (f))
{
delete = 0;
break;
}
}
if (delete)
delete_tty (FRAME_TTY (f));
}
f->output_data.nothing = 0;
/* If we've deleted the last_nonminibuf_frame, then try to find
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment