aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroly Lorentey2004-07-10 21:21:04 +0000
committerKaroly Lorentey2004-07-10 21:21:04 +0000
commit4a933ef8f05e3e0dd3c5a201468e35753a430cc8 (patch)
treef84032e30ae16dd1e273ac136e543b47e09bfe4a
parentc5b0a355298aba2872635de196204c0030e09996 (diff)
downloademacs-4a933ef8f05e3e0dd3c5a201468e35753a430cc8.tar.gz
emacs-4a933ef8f05e3e0dd3c5a201468e35753a430cc8.zip
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
-rw-r--r--lisp/frame.el6
-rw-r--r--src/keyboard.c2
-rw-r--r--src/term.c18
3 files changed, 21 insertions, 5 deletions
diff --git a/lisp/frame.el b/lisp/frame.el
index 13a1ca50adf..243ad71497d 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -788,9 +788,9 @@ Calls `suspend-emacs' if invoked from the controlling terminal,
788 (cond 788 (cond
789 ((eq type 'x) (iconify-or-deiconify-frame)) 789 ((eq type 'x) (iconify-or-deiconify-frame))
790 ((eq type t) 790 ((eq type t)
791 (if (display-name) 791 (if (display-controlling-tty-p)
792 (suspend-tty) 792 (suspend-emacs)
793 (suspend-emacs))) 793 (suspend-tty)))
794 (t (suspend-emacs))))) 794 (t (suspend-emacs)))))
795 795
796 796
diff --git a/src/keyboard.c b/src/keyboard.c
index 7c1c6f3f463..3fc685d58c7 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10193,7 +10193,7 @@ On such systems, Emacs starts a subshell instead of suspending. */)
10193 struct gcpro gcpro1; 10193 struct gcpro gcpro1;
10194 10194
10195 if (tty_list && tty_list->next) 10195 if (tty_list && tty_list->next)
10196 error ("Suspend is not supported with multiple ttys"); 10196 error ("There are other tty frames open; close them before suspending Emacs");
10197 10197
10198 if (!NILP (stuffstring)) 10198 if (!NILP (stuffstring))
10199 CHECK_STRING (stuffstring); 10199 CHECK_STRING (stuffstring);
diff --git a/src/term.c b/src/term.c
index 629c823e8b2..899829ebadb 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2197,7 +2197,6 @@ frame's display). */)
2197 return Qnil; 2197 return Qnil;
2198} 2198}
2199 2199
2200
2201DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0, 2200DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0,
2202 doc: /* Return the type of the TTY device that DISPLAY uses. */) 2201 doc: /* Return the type of the TTY device that DISPLAY uses. */)
2203 (display) 2202 (display)
@@ -2216,6 +2215,22 @@ DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0,
2216 return Qnil; 2215 return Qnil;
2217} 2216}
2218 2217
2218DEFUN ("display-controlling-tty-p", Fdisplay_controlling_tty_p, Sdisplay_controlling_tty_p, 0, 1, 0,
2219 doc: /* Return non-nil if DISPLAY is on the controlling tty of the Emacs process. */)
2220 (display)
2221 Lisp_Object display;
2222{
2223 struct display *d = get_display (display);
2224
2225 if (!d)
2226 wrong_type_argument (Qdisplay_live_p, display);
2227
2228 if (d->type != output_termcap || d->display_info.tty->name)
2229 return Qnil;
2230 else
2231 return Qt;
2232}
2233
2219 2234
2220/*********************************************************************** 2235/***********************************************************************
2221 Initialization 2236 Initialization
@@ -3363,6 +3378,7 @@ See `resume-tty'. */);
3363 defsubr (&Stty_display_color_cells); 3378 defsubr (&Stty_display_color_cells);
3364 defsubr (&Sdisplay_name); 3379 defsubr (&Sdisplay_name);
3365 defsubr (&Sdisplay_tty_type); 3380 defsubr (&Sdisplay_tty_type);
3381 defsubr (&Sdisplay_controlling_tty_p);
3366 defsubr (&Sdelete_display); 3382 defsubr (&Sdelete_display);
3367 defsubr (&Sdisplay_live_p); 3383 defsubr (&Sdisplay_live_p);
3368 defsubr (&Sdisplay_list); 3384 defsubr (&Sdisplay_list);