aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroly Lorentey2003-12-29 08:28:35 +0000
committerKaroly Lorentey2003-12-29 08:28:35 +0000
commitb2af72d2f0da11c271cac6fc823053d0018068b2 (patch)
tree3eb8facc529c3360f7c85416cc93249fb9b6a337
parent9f729af551e991e5f6d49f329674f6802450d70f (diff)
downloademacs-b2af72d2f0da11c271cac6fc823053d0018068b2.tar.gz
emacs-b2af72d2f0da11c271cac6fc823053d0018068b2.zip
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
-rw-r--r--README.multi-tty28
-rw-r--r--lisp/server.el16
-rw-r--r--src/cm.c3
-rw-r--r--src/keyboard.c4
4 files changed, 32 insertions, 19 deletions
diff --git a/README.multi-tty b/README.multi-tty
index ffa4b18ba81..391562e4e54 100644
--- a/README.multi-tty
+++ b/README.multi-tty
@@ -198,6 +198,21 @@ DIARY OF CHANGES
198 198
199 (Done.) 199 (Done.)
200 200
201-- C-g should work on secondary terminals.
202
203 (Done, but the binding is not configurable.)
204
205-- Deal with SIGHUP in Emacs and in emacsclient. (After this, the
206 server-frames may be removed from server.el.)
207
208 (Done, nothing to do. It seems that Emacs does not receive SIGHUP
209 from secondary ttys.)
210
211-- Change emacsclient/server.el to support the -h argument better,
212 i.e. automatically close the socket when the frame is closed.
213
214 (Seems to be working OK.)
215
201THINGS TO DO 216THINGS TO DO
202------------ 217------------
203 218
@@ -217,15 +232,13 @@ THINGS TO DO
217 Update: yes it does, although it is much rarer. Or maybe it's 232 Update: yes it does, although it is much rarer. Or maybe it's
218 another bug. 233 another bug.
219 234
220** Change emacsclient/server.el to support the -h argument better, 235** Make parts of struct tty_output accessible from Lisp. The device
221 i.e. automatically close the socket when the frame is closed. 236 name and the type is sufficient.
222 237
223** Export delete_tty to the Lisp environment, for emacsclient. 238** Export delete_tty to the Lisp environment, for emacsclient.
224 239
225** C-g should work on secondary terminals. 240** Make sure C-g goes to the right frame. This is hard, as SIGINT
226 241 doesn't have a tty parameter. :-(
227** Make parts of struct tty_output accessible from Lisp. The device
228 name and the type is sufficient.
229 242
230** Find out why does Emacs abort when it wants to close its 243** Find out why does Emacs abort when it wants to close its
231 controlling tty. Hint: chan_process[] array. Hey, maybe 244 controlling tty. Hint: chan_process[] array. Hey, maybe
@@ -251,9 +264,6 @@ THINGS TO DO
251** Find out the best way to support suspending Emacs with multiple 264** Find out the best way to support suspending Emacs with multiple
252 ttys. 265 ttys.
253 266
254** Deal with SIGHUP in Emacs and in emacsclient. (After this, the
255 server-frames may be removed from server.el.)
256
257** Do tty output through term_hooks, like all other display backends. 267** Do tty output through term_hooks, like all other display backends.
258 268
259** Fix X support. 269** Fix X support.
diff --git a/lisp/server.el b/lisp/server.el
index d57739fbef4..401668138c4 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -185,7 +185,9 @@ are done with it in the server.")
185 ;; Remove PROC from the list of clients. 185 ;; Remove PROC from the list of clients.
186 (when client 186 (when client
187 (setq server-clients (delq client server-clients)) 187 (setq server-clients (delq client server-clients))
188 (setq server-frames (delq client server-frames)) 188 (let ((frame (assq (car client) server-frames)))
189 (setq server-frames (delq frame server-frames))
190 (when (frame-live-p (cadr frame)) (delete-frame (cadr frame))))
189 (dolist (buf (cdr client)) 191 (dolist (buf (cdr client))
190 (with-current-buffer buf 192 (with-current-buffer buf
191 ;; Remove PROC from the clients of each buffer. 193 ;; Remove PROC from the clients of each buffer.
@@ -378,9 +380,9 @@ PROC is the server process. Format of STRING is \"PATH PATH PATH... \\n\"."
378 (if (null (cdr client)) 380 (if (null (cdr client))
379 ;; This client is empty; get rid of it immediately. 381 ;; This client is empty; get rid of it immediately.
380 (progn 382 (progn
381 (let ((frame (cadr (assq (car client) server-frames)))) 383 (let ((frame (assq (car client) server-frames)))
382 ;; Close the client's frame. 384 (setq server-frames (delq frame server-frames))
383 (when frame (delete-frame frame))) 385 (when (frame-live-p (cadr frame)) (delete-frame (cadr frame))))
384 (delete-process proc) 386 (delete-process proc)
385 (server-log "Close empty client" proc)) 387 (server-log "Close empty client" proc))
386 ;; We visited some buffer for this client. 388 ;; We visited some buffer for this client.
@@ -467,9 +469,9 @@ FOR-KILLING if non-nil indicates that we are called from `kill-buffer'."
467 ;; If client now has no pending buffers, 469 ;; If client now has no pending buffers,
468 ;; tell it that it is done, and forget it entirely. 470 ;; tell it that it is done, and forget it entirely.
469 (unless (cdr client) 471 (unless (cdr client)
470 (let ((frame (cadr (assq (car client) server-frames)))) 472 (let ((frame (assq (car client) server-frames)))
471 ;; Close the client's frame. 473 (setq server-frames (delq frame server-frames))
472 (when frame (delete-frame frame))) 474 (when (frame-live-p (cadr frame)) (delete-frame (cadr frame))))
473 (delete-process (car client)) 475 (delete-process (car client))
474 (server-log "Close" (car client)) 476 (server-log "Close" (car client))
475 (setq server-clients (delq client server-clients)))) 477 (setq server-clients (delq client server-clients))))
diff --git a/src/cm.c b/src/cm.c
index 95aa6afdcd6..1094e3047d6 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -70,7 +70,8 @@ cmputc (c)
70{ 70{
71 if (TTY_TERMSCRIPT (current_tty)) 71 if (TTY_TERMSCRIPT (current_tty))
72 putc (c & 0177, TTY_TERMSCRIPT (current_tty)); 72 putc (c & 0177, TTY_TERMSCRIPT (current_tty));
73 putc (c & 0177, TTY_OUTPUT (current_tty)); 73 if (putc (c & 0177, TTY_OUTPUT (current_tty)) == EOF)
74 abort (); /* XXX For testing only! */
74 return c; 75 return c;
75} 76}
76 77
diff --git a/src/keyboard.c b/src/keyboard.c
index 217cc290464..1bb9564060f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -6689,7 +6689,7 @@ read_avail_input (expected)
6689 if (! tty_list->next) 6689 if (! tty_list->next)
6690 kill (0, SIGHUP); /* This was the last terminal. */ 6690 kill (0, SIGHUP); /* This was the last terminal. */
6691 else 6691 else
6692 ; /* XXX tty should be closed here. */ 6692 delete_tty (tty); /* XXX I wonder if this is safe here. */
6693 } 6693 }
6694#if defined (AIX) && (! defined (aix386) && defined (_BSD)) 6694#if defined (AIX) && (! defined (aix386) && defined (_BSD))
6695 /* The kernel sometimes fails to deliver SIGHUP for ptys. 6695 /* The kernel sometimes fails to deliver SIGHUP for ptys.
@@ -6701,7 +6701,7 @@ read_avail_input (expected)
6701 if (! tty_list->next) 6701 if (! tty_list->next)
6702 kill (0, SIGHUP); /* This was the last terminal. */ 6702 kill (0, SIGHUP); /* This was the last terminal. */
6703 else 6703 else
6704 ; /* XXX tty should be closed here. */ 6704 delete_tty (tty); /* XXX I wonder if this is safe here. */
6705 } 6705 }
6706#endif 6706#endif
6707 } 6707 }