changeset 83173:6b4b299e2cd5

Fix suspend-frame on the controlling tty (reported by Dan Nicolaescu). * src/term.c (Fdisplay_controlling_tty_p): New function. * src/term.c (syms_of_term): Initialize Sdisplay_controlling_tty_p. * lisp/frame.el (suspend-frame): Use display-controlling-tty-p to decide between suspend-emacs and suspend-tty. * src/keyboard.c (Fsuspend_emacs): Give a better error message when there are multiple open tty devices. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-213
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 10 Jul 2004 21:21:04 +0000
parents 1a136b47986d
children dbb0d508babe
files lisp/frame.el src/keyboard.c src/term.c
diffstat 3 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/frame.el	Sat Jul 10 20:56:57 2004 +0000
+++ b/lisp/frame.el	Sat Jul 10 21:21:04 2004 +0000
@@ -788,9 +788,9 @@
     (cond
      ((eq type 'x) (iconify-or-deiconify-frame))
      ((eq type t)
-      (if (display-name)
-	  (suspend-tty)
-	(suspend-emacs)))
+      (if (display-controlling-tty-p)
+	  (suspend-emacs)
+	(suspend-tty)))
      (t (suspend-emacs)))))
 
 
--- a/src/keyboard.c	Sat Jul 10 20:56:57 2004 +0000
+++ b/src/keyboard.c	Sat Jul 10 21:21:04 2004 +0000
@@ -10193,7 +10193,7 @@
   struct gcpro gcpro1;
 
   if (tty_list && tty_list->next)
-    error ("Suspend is not supported with multiple ttys");
+    error ("There are other tty frames open; close them before suspending Emacs");
 
   if (!NILP (stuffstring))
     CHECK_STRING (stuffstring);
--- a/src/term.c	Sat Jul 10 20:56:57 2004 +0000
+++ b/src/term.c	Sat Jul 10 21:21:04 2004 +0000
@@ -2197,7 +2197,6 @@
     return Qnil;
 }
 
-
 DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0,
        doc: /* Return the type of the TTY device that DISPLAY uses. */)
   (display)
@@ -2216,6 +2215,22 @@
     return Qnil;
 }
 
+DEFUN ("display-controlling-tty-p", Fdisplay_controlling_tty_p, Sdisplay_controlling_tty_p, 0, 1, 0,
+       doc: /* Return non-nil if DISPLAY is on the controlling tty of the Emacs process. */)
+  (display)
+     Lisp_Object display;
+{
+  struct display *d = get_display (display);
+
+  if (!d)
+    wrong_type_argument (Qdisplay_live_p, display);
+
+  if (d->type != output_termcap || d->display_info.tty->name)
+    return Qnil;
+  else
+    return Qt;
+}
+
 
 /***********************************************************************
 			    Initialization
@@ -3363,6 +3378,7 @@
   defsubr (&Stty_display_color_cells);
   defsubr (&Sdisplay_name);
   defsubr (&Sdisplay_tty_type);
+  defsubr (&Sdisplay_controlling_tty_p);
   defsubr (&Sdelete_display);
   defsubr (&Sdisplay_live_p);
   defsubr (&Sdisplay_list);