summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2004-01-03 09:08:15 +0000
committerKaroly Lorentey <lorentey@elte.hu>2004-01-03 09:08:15 +0000
commit170867326e2670d6e91256a020a70c53386251db (patch)
treef424dffd920791357cc16129e3af851d8b25a5d7 /lisp
parent72d785653db3f07a7d918660214c62d730b47aba (diff)
downloademacs-170867326e2670d6e91256a020a70c53386251db.tar.gz
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
Diffstat (limited to 'lisp')
-rw-r--r--lisp/talk.el28
1 files changed, 28 insertions, 0 deletions
diff --git a/lisp/talk.el b/lisp/talk.el
index bbe9c949dde..3d7c45281aa 100644
--- a/lisp/talk.el
+++ b/lisp/talk.el
@@ -45,6 +45,19 @@ Each element has the form (DISPLAY FRAME BUFFER).")
;; 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 @@ Each element has the form (DISPLAY FRAME BUFFER).")
(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)