Function: suspend-tty
suspend-tty is a function defined in term.c.
Signature
(suspend-tty &optional TTY)
Documentation
Suspend the terminal device TTY.
The device is restored to its default state, and Emacs ceases all access to the tty device. Frames that use the device are not deleted, but input is not read from them and if they change, their display is not updated.
TTY may be a terminal object, a frame, or nil for the terminal device of the currently selected frame.
This function runs suspend-tty-functions after suspending the
device. The functions are run with one arg, the id of the suspended
terminal device.
suspend-tty does nothing if it is called on a device that is already
suspended.
A suspended tty may be resumed by calling resume-tty on it.
Probably introduced at or before Emacs version 23.1.
Source Code
// Defined in /usr/src/emacs/src/term.c
{
#ifndef HAVE_ANDROID
struct terminal *t = decode_tty_terminal (tty);
FILE *f;
if (!t)
error ("Attempt to suspend a non-text terminal device");
f = t->display_info.tty->input;
if (f)
{
/* First run `suspend-tty-functions' and then clean up the tty
state because `suspend-tty-functions' might need to change
the tty state. */
Lisp_Object term;
XSETTERMINAL (term, t);
CALLN (Frun_hook_with_args, Qsuspend_tty_functions, term);
reset_sys_modes (t->display_info.tty);
delete_keyboard_wait_descriptor (fileno (f));
#ifndef MSDOS
if (f != t->display_info.tty->output)
emacs_fclose (t->display_info.tty->output);
emacs_fclose (f);
#endif /* !MSDOS */
t->display_info.tty->input = 0;
t->display_info.tty->output = 0;
if (FRAMEP (t->display_info.tty->top_frame))
SET_FRAME_VISIBLE (XFRAME (t->display_info.tty->top_frame), 0);
}
/* Clear display hooks to prevent further output. */
clear_tty_hooks (t);
#else /* HAVE_ANDROID */
/* Android doesn't support TTY terminal devices, so unconditionally
signal. */
error ("Attempt to suspend a non-text terminal device");
#endif /* !HAVE_ANDROID */
return Qnil;
}