Function: delete-terminal

delete-terminal is a function defined in terminal.c.

Signature

(delete-terminal &optional TERMINAL FORCE)

Documentation

Delete TERMINAL by deleting all frames on it and closing the terminal.

TERMINAL may be a terminal object, a frame, or nil (meaning the selected frame's terminal).

Normally, you may not delete a display if all other displays are suspended, but if the second argument FORCE is non-nil, you may do so.

View in manual

Probably introduced at or before Emacs version 23.1.

Source Code

// Defined in /usr/src/emacs/src/terminal.c
{
  struct terminal *t = decode_terminal (terminal);

  if (!t)
    return Qnil;

  if (NILP (force))
    {
      struct terminal *p = terminal_list;
      while (p && (p == t || !TERMINAL_ACTIVE_P (p)))
	p = p->next_terminal;

      if (!p)
	error ("Attempt to delete the sole active display terminal");
    }

  if (NILP (Vrun_hooks))
    ;
  else if (EQ (force, Qnoelisp))
    pending_funcalls
      = Fcons (list3 (Qrun_hook_with_args,
		      Qdelete_terminal_functions, terminal),
	       pending_funcalls);
  else
    safe_call2 (Qrun_hook_with_args, Qdelete_terminal_functions, terminal);

  if (t->delete_terminal_hook)
    (*t->delete_terminal_hook) (t);
  else
    delete_terminal (t);

  return Qnil;
}