changeset 82997:af2d6b850383

Added multi-tty support for talk.el. lisp/talk.el: Extended for multi-tty support. (talk, talk-add-tty-frame, talk-handle-delete-tty): New functions. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-37
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 03 Jan 2004 09:08:15 +0000
parents c16b10dde3f2
children 24fb0f3a63a1
files README.multi-tty lisp/talk.el
diffstat 2 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/README.multi-tty	Sat Jan 03 08:33:31 2004 +0000
+++ b/README.multi-tty	Sat Jan 03 09:08:15 2004 +0000
@@ -445,4 +445,8 @@
    (Done, did exactly that.  Core dumps during combo sessions became
    much rarer.  In fact, I have not yet met a single one.)
 
+-- Add multi-tty support to talk.el.
+
+   (Done.)
+
 ;;; arch-tag: 8da1619e-2e79-41a8-9ac9-a0485daad17d
--- a/lisp/talk.el	Sat Jan 03 08:33:31 2004 +0000
+++ b/lisp/talk.el	Sat Jan 03 09:08:15 2004 +0000
@@ -45,6 +45,19 @@
   ;; Add the new buffers to all talk frames.
   (talk-update-buffers))
 
+;;;###autoload
+(defun talk ()
+  "Connect to the Emacs talk group from the current X display or tty frame."
+  (interactive)
+  (let ((type (frame-live-p (selected-frame))))
+    (case type
+      ;; Termcap frame
+      ((t) (talk-add-tty-frame (selected-frame)))
+      ;; X frame
+      ((x) (talk-add-display (frame-parameter (selected-frame) 'display)))
+      (t (error "Could not determine frame type"))))
+  (talk-update-buffers))
+
 (defun talk-add-display (display)
   (let* ((elt (assoc display talk-display-alist))
 	 (name (concat "*talk-" display "*"))
@@ -56,6 +69,21 @@
     (setq talk-display-alist
 	  (cons (list display frame buffer) (delq elt talk-display-alist)))))
 
+(defun talk-add-tty-frame (frame)
+  (let* ((elt (assoc (frame-tty-name frame) talk-display-alist))
+	 (name (concat "*talk-" (frame-tty-name frame) "*"))
+	 buffer)
+    (if (not (and elt (buffer-name (get-buffer (setq buffer (nth 2 elt))))))
+	(setq buffer (get-buffer-create name)))
+    (add-to-list 'delete-tty-after-functions 'talk-handle-delete-tty)
+    (setq talk-display-alist
+	  (cons (list (frame-tty-name frame) frame buffer) (delq elt talk-display-alist)))))
+
+(defun talk-handle-delete-tty (tty)
+  (let (elt (assoc tty talk-display-alist))
+    (setq talk-display-alist (delq elt talk-display-alist))
+    (talk-update-buffers)))
+
 (defun talk-disconnect ()
   "Disconnect this display from the Emacs talk group."
   (interactive)