changeset 94904:c71ea3609cd7

(talk): Simplify. Pass display arg to talk-add-display as a string. (talk-add-display): Simplify. Accept only string args.
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 13 May 2008 20:50:32 +0000
parents 052e05b47926
children c3aeab0459b2
files lisp/talk.el
diffstat 1 files changed, 10 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/talk.el	Tue May 13 20:50:01 2008 +0000
+++ b/lisp/talk.el	Tue May 13 20:50:32 2008 +0000
@@ -50,26 +50,19 @@
   (interactive)
   (let ((type (frame-live-p (selected-frame)))
 	(display (frame-terminal (selected-frame))))
-    (cond
-     ((eq type t)
-      (talk-add-display (selected-frame)))
-     ((eq type 'x)
-      (talk-add-display (frame-terminal (selected-frame))))
-     (t
-      (error "Unknown frame type"))))
+    (if (or (eq type t) (eq type 'x))
+	(talk-add-display 
+	 (terminal-name (frame-terminal (selected-frame))))
+      (error "Unknown frame type")))
   (talk-update-buffers))
 
-(defun talk-add-display (frame)
-  (let* ((display (if (frame-live-p frame)
-		      (frame-terminal frame)
-		    frame))
-	 (elt (assoc display talk-display-alist))
-	 (name (concat "*talk-" (terminal-name display) "*"))
-	 buffer)
-    (unless (frame-live-p frame)
+(defun talk-add-display (display)
+  (let* ((elt (assoc display talk-display-alist))
+	 (name (concat "*talk-" display "*"))
+	 frame buffer)
+    (if (and elt (frame-live-p (nth 1 elt)))
+	(setq frame (nth 1 elt))
       (setq frame (make-frame-on-display display (list (cons 'name name)))))
-    (if (and elt (frame-live-p (nth 1 elt)))
-	(setq frame (nth 1 elt)))
     (if (not (and elt (buffer-name (get-buffer (setq buffer (nth 2 elt))))))
 	(setq buffer (get-buffer-create name)))
     (add-to-list 'delete-frame-functions 'talk-handle-delete-frame)