# HG changeset patch # User Karoly Lorentey # Date 1089494464 0 # Node ID 6b4b299e2cd587e30f771ad37642bf1f63e93054 # Parent 1a136b47986df0ffc67e1dfd74ed3ed6ed1f9e20 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 diff -r 1a136b47986d -r 6b4b299e2cd5 lisp/frame.el --- 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))))) diff -r 1a136b47986d -r 6b4b299e2cd5 src/keyboard.c --- 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); diff -r 1a136b47986d -r 6b4b299e2cd5 src/term.c --- 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);