Mercurial > emacs
comparison lisp/talk.el @ 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 | 695cf19ef79e |
children | 24fb0f3a63a1 |
comparison
equal
deleted
inserted
replaced
82996:c16b10dde3f2 | 82997:af2d6b850383 |
---|---|
43 ;; Make sure we have an entry for the specified display. | 43 ;; Make sure we have an entry for the specified display. |
44 (talk-add-display display) | 44 (talk-add-display display) |
45 ;; Add the new buffers to all talk frames. | 45 ;; Add the new buffers to all talk frames. |
46 (talk-update-buffers)) | 46 (talk-update-buffers)) |
47 | 47 |
48 ;;;###autoload | |
49 (defun talk () | |
50 "Connect to the Emacs talk group from the current X display or tty frame." | |
51 (interactive) | |
52 (let ((type (frame-live-p (selected-frame)))) | |
53 (case type | |
54 ;; Termcap frame | |
55 ((t) (talk-add-tty-frame (selected-frame))) | |
56 ;; X frame | |
57 ((x) (talk-add-display (frame-parameter (selected-frame) 'display))) | |
58 (t (error "Could not determine frame type")))) | |
59 (talk-update-buffers)) | |
60 | |
48 (defun talk-add-display (display) | 61 (defun talk-add-display (display) |
49 (let* ((elt (assoc display talk-display-alist)) | 62 (let* ((elt (assoc display talk-display-alist)) |
50 (name (concat "*talk-" display "*")) | 63 (name (concat "*talk-" display "*")) |
51 buffer frame) | 64 buffer frame) |
52 (if (not (and elt (frame-live-p (setq frame (nth 1 elt))))) | 65 (if (not (and elt (frame-live-p (setq frame (nth 1 elt))))) |
53 (setq frame (make-frame-on-display display (list (cons 'name name))))) | 66 (setq frame (make-frame-on-display display (list (cons 'name name))))) |
54 (if (not (and elt (buffer-name (get-buffer (setq buffer (nth 2 elt)))))) | 67 (if (not (and elt (buffer-name (get-buffer (setq buffer (nth 2 elt)))))) |
55 (setq buffer (get-buffer-create name))) | 68 (setq buffer (get-buffer-create name))) |
56 (setq talk-display-alist | 69 (setq talk-display-alist |
57 (cons (list display frame buffer) (delq elt talk-display-alist))))) | 70 (cons (list display frame buffer) (delq elt talk-display-alist))))) |
71 | |
72 (defun talk-add-tty-frame (frame) | |
73 (let* ((elt (assoc (frame-tty-name frame) talk-display-alist)) | |
74 (name (concat "*talk-" (frame-tty-name frame) "*")) | |
75 buffer) | |
76 (if (not (and elt (buffer-name (get-buffer (setq buffer (nth 2 elt)))))) | |
77 (setq buffer (get-buffer-create name))) | |
78 (add-to-list 'delete-tty-after-functions 'talk-handle-delete-tty) | |
79 (setq talk-display-alist | |
80 (cons (list (frame-tty-name frame) frame buffer) (delq elt talk-display-alist))))) | |
81 | |
82 (defun talk-handle-delete-tty (tty) | |
83 (let (elt (assoc tty talk-display-alist)) | |
84 (setq talk-display-alist (delq elt talk-display-alist)) | |
85 (talk-update-buffers))) | |
58 | 86 |
59 (defun talk-disconnect () | 87 (defun talk-disconnect () |
60 "Disconnect this display from the Emacs talk group." | 88 "Disconnect this display from the Emacs talk group." |
61 (interactive) | 89 (interactive) |
62 (let* ((mydisp (cdr (assq 'display (frame-parameters (selected-frame))))) | 90 (let* ((mydisp (cdr (assq 'display (frame-parameters (selected-frame))))) |