Mercurial > emacs
changeset 53343:56e4b7166995
Make sure secondary frames are deleted when emacsclient quits.
lisp/server.el (server-sentinel): Delete frame if alive. Fix delq
invocation on server-frames.
(server-process-filter, server-buffer-done): Fix delq invocation on
server-frames.
src/cm.c (cmputc): Abort on write error, see what happens.
src/keyboard.c (read_avail_input): Do delete_tty on read errors.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-21
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Mon, 29 Dec 2003 08:28:35 +0000 |
parents | 201b17b0f2e5 |
children | 1747ce67f759 |
files | README.multi-tty lisp/server.el src/cm.c src/keyboard.c |
diffstat | 4 files changed, 32 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/README.multi-tty Mon Dec 29 07:24:41 2003 +0000 +++ b/README.multi-tty Mon Dec 29 08:28:35 2003 +0000 @@ -198,6 +198,21 @@ (Done.) +-- C-g should work on secondary terminals. + + (Done, but the binding is not configurable.) + +-- Deal with SIGHUP in Emacs and in emacsclient. (After this, the + server-frames may be removed from server.el.) + + (Done, nothing to do. It seems that Emacs does not receive SIGHUP + from secondary ttys.) + +-- Change emacsclient/server.el to support the -h argument better, + i.e. automatically close the socket when the frame is closed. + + (Seems to be working OK.) + THINGS TO DO ------------ @@ -217,15 +232,13 @@ Update: yes it does, although it is much rarer. Or maybe it's another bug. -** Change emacsclient/server.el to support the -h argument better, - i.e. automatically close the socket when the frame is closed. +** 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. -** C-g should work on secondary terminals. - -** Make parts of struct tty_output accessible from Lisp. The device - name and the type is sufficient. +** Make sure C-g goes to the right frame. This is hard, as SIGINT + doesn't have a tty parameter. :-( ** Find out why does Emacs abort when it wants to close its controlling tty. Hint: chan_process[] array. Hey, maybe @@ -251,9 +264,6 @@ ** Find out the best way to support suspending Emacs with multiple ttys. -** Deal with SIGHUP in Emacs and in emacsclient. (After this, the - server-frames may be removed from server.el.) - ** Do tty output through term_hooks, like all other display backends. ** Fix X support.
--- a/lisp/server.el Mon Dec 29 07:24:41 2003 +0000 +++ b/lisp/server.el Mon Dec 29 08:28:35 2003 +0000 @@ -185,7 +185,9 @@ ;; Remove PROC from the list of clients. (when client (setq server-clients (delq client server-clients)) - (setq server-frames (delq client server-frames)) + (let ((frame (assq (car client) server-frames))) + (setq server-frames (delq frame server-frames)) + (when (frame-live-p (cadr frame)) (delete-frame (cadr frame)))) (dolist (buf (cdr client)) (with-current-buffer buf ;; Remove PROC from the clients of each buffer. @@ -378,9 +380,9 @@ (if (null (cdr client)) ;; This client is empty; get rid of it immediately. (progn - (let ((frame (cadr (assq (car client) server-frames)))) - ;; Close the client's frame. - (when frame (delete-frame frame))) + (let ((frame (assq (car client) server-frames))) + (setq server-frames (delq frame server-frames)) + (when (frame-live-p (cadr frame)) (delete-frame (cadr frame)))) (delete-process proc) (server-log "Close empty client" proc)) ;; We visited some buffer for this client. @@ -467,9 +469,9 @@ ;; If client now has no pending buffers, ;; tell it that it is done, and forget it entirely. (unless (cdr client) - (let ((frame (cadr (assq (car client) server-frames)))) - ;; Close the client's frame. - (when frame (delete-frame frame))) + (let ((frame (assq (car client) server-frames))) + (setq server-frames (delq frame server-frames)) + (when (frame-live-p (cadr frame)) (delete-frame (cadr frame)))) (delete-process (car client)) (server-log "Close" (car client)) (setq server-clients (delq client server-clients))))
--- a/src/cm.c Mon Dec 29 07:24:41 2003 +0000 +++ b/src/cm.c Mon Dec 29 08:28:35 2003 +0000 @@ -70,7 +70,8 @@ { if (TTY_TERMSCRIPT (current_tty)) putc (c & 0177, TTY_TERMSCRIPT (current_tty)); - putc (c & 0177, TTY_OUTPUT (current_tty)); + if (putc (c & 0177, TTY_OUTPUT (current_tty)) == EOF) + abort (); /* XXX For testing only! */ return c; }
--- a/src/keyboard.c Mon Dec 29 07:24:41 2003 +0000 +++ b/src/keyboard.c Mon Dec 29 08:28:35 2003 +0000 @@ -6689,7 +6689,7 @@ if (! tty_list->next) kill (0, SIGHUP); /* This was the last terminal. */ else - ; /* XXX tty should be closed here. */ + delete_tty (tty); /* XXX I wonder if this is safe here. */ } #if defined (AIX) && (! defined (aix386) && defined (_BSD)) /* The kernel sometimes fails to deliver SIGHUP for ptys. @@ -6701,7 +6701,7 @@ if (! tty_list->next) kill (0, SIGHUP); /* This was the last terminal. */ else - ; /* XXX tty should be closed here. */ + delete_tty (tty); /* XXX I wonder if this is safe here. */ } #endif }