diff options
| author | Karoly Lorentey | 2003-12-27 13:55:54 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2003-12-27 13:55:54 +0000 |
| commit | 8303ba32ba3f0c925ac8ac5540e85ca497e9b809 (patch) | |
| tree | f5efb48c9489c8813086c757384f554cc5192bc9 | |
| parent | bc279d67ae14ecb4755aad2003f9f616ab22b92f (diff) | |
| download | emacs-8303ba32ba3f0c925ac8ac5540e85ca497e9b809.tar.gz emacs-8303ba32ba3f0c925ac8ac5540e85ca497e9b809.zip | |
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
| -rw-r--r-- | README.multi-tty | 15 | ||||
| -rw-r--r-- | lisp/server.el | 6 | ||||
| -rw-r--r-- | src/frame.c | 20 |
3 files changed, 33 insertions, 8 deletions
diff --git a/README.multi-tty b/README.multi-tty index 22f74c5b0b4..a9bd9f7e9c9 100644 --- a/README.multi-tty +++ b/README.multi-tty | |||
| @@ -180,6 +180,11 @@ DIARY OF CHANGES | |||
| 180 | initialization. There is a memory corruption error around this | 180 | initialization. There is a memory corruption error around this |
| 181 | somewhere.) | 181 | somewhere.) |
| 182 | 182 | ||
| 183 | -- Implement automatic deletion of terminals when the last frame on | ||
| 184 | that terminal is closed. | ||
| 185 | |||
| 186 | (Done.) | ||
| 187 | |||
| 183 | 188 | ||
| 184 | THINGS TO DO | 189 | THINGS TO DO |
| 185 | ------------ | 190 | ------------ |
| @@ -200,16 +205,16 @@ THINGS TO DO | |||
| 200 | Update: yes it does, although it is much rarer. Or maybe it's | 205 | Update: yes it does, although it is much rarer. Or maybe it's |
| 201 | another bug. | 206 | another bug. |
| 202 | 207 | ||
| 203 | ** C-g should work on secondary terminals. | 208 | ** Change emacsclient/server.el to support the -h argument better, |
| 209 | i.e. automatically close the socket when the frame is closed. | ||
| 204 | 210 | ||
| 205 | ** Implement automatic deletion of terminals when the last frame on | 211 | ** Export delete_tty to the Lisp environment, for emacsclient. |
| 206 | that terminal is closed. | 212 | |
| 213 | ** C-g should work on secondary terminals. | ||
| 207 | 214 | ||
| 208 | ** Make parts of struct tty_output accessible from Lisp. The device | 215 | ** Make parts of struct tty_output accessible from Lisp. The device |
| 209 | name and the type is sufficient. | 216 | name and the type is sufficient. |
| 210 | 217 | ||
| 211 | ** Export delete_tty to the Lisp environment, for emacsclient. | ||
| 212 | |||
| 213 | ** Implement support for starting an interactive Emacs session without | 218 | ** Implement support for starting an interactive Emacs session without |
| 214 | an initial frame. (The user would connect to it and open frames | 219 | an initial frame. (The user would connect to it and open frames |
| 215 | later, with emacsclient.) Not necessarily a good idea. | 220 | later, with emacsclient.) Not necessarily a good idea. |
diff --git a/lisp/server.el b/lisp/server.el index 9721dbc4a41..0a3eb446761 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -325,9 +325,9 @@ PROC is the server process. Format of STRING is \"PATH PATH PATH... \\n\"." | |||
| 325 | (type (server-unquote-arg (match-string 2 request)))) | 325 | (type (server-unquote-arg (match-string 2 request)))) |
| 326 | (setq request (substring request (match-end 0))) | 326 | (setq request (substring request (match-end 0))) |
| 327 | (condition-case err | 327 | (condition-case err |
| 328 | (progn | 328 | (let ((frame (make-terminal-frame `((tty . ,pty) (tty-type . ,type))))) |
| 329 | (make-terminal-frame `((tty . ,pty) (tty-type . ,type))) | 329 | (process-send-string proc (concat (number-to-string (emacs-pid)) "\n")) |
| 330 | (process-send-string proc (concat (number-to-string (emacs-pid)) "\n"))) | 330 | (select-frame frame)) |
| 331 | (error (process-send-string proc (nth 1 err)) | 331 | (error (process-send-string proc (nth 1 err)) |
| 332 | (setq request ""))))) | 332 | (setq request ""))))) |
| 333 | ;; ARG is a line number option. | 333 | ;; ARG is a line number option. |
diff --git a/src/frame.c b/src/frame.c index 72d28c72b79..8f8dea8fa75 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -1381,6 +1381,26 @@ The functions are run with one arg, the frame to be deleted. */) | |||
| 1381 | x_destroy_window (f); | 1381 | x_destroy_window (f); |
| 1382 | #endif | 1382 | #endif |
| 1383 | 1383 | ||
| 1384 | if (FRAME_TERMCAP_P (f)) | ||
| 1385 | { | ||
| 1386 | /* See if the terminal needs to be closed. */ | ||
| 1387 | Lisp_Object tail, frame1; | ||
| 1388 | int delete = 1; | ||
| 1389 | |||
| 1390 | FOR_EACH_FRAME (tail, frame1) | ||
| 1391 | { | ||
| 1392 | if (!FRAME_LIVE_P (XFRAME (frame1)) && | ||
| 1393 | FRAME_TERMCAP_P (XFRAME (frame1)) && | ||
| 1394 | FRAME_TTY (XFRAME (frame1)) == FRAME_TTY (f)) | ||
| 1395 | { | ||
| 1396 | delete = 0; | ||
| 1397 | break; | ||
| 1398 | } | ||
| 1399 | } | ||
| 1400 | if (delete) | ||
| 1401 | delete_tty (FRAME_TTY (f)); | ||
| 1402 | } | ||
| 1403 | |||
| 1384 | f->output_data.nothing = 0; | 1404 | f->output_data.nothing = 0; |
| 1385 | 1405 | ||
| 1386 | /* If we've deleted the last_nonminibuf_frame, then try to find | 1406 | /* If we've deleted the last_nonminibuf_frame, then try to find |