Function: open-termscript

open-termscript is an interactive function defined in dispnew.c.

Signature

(open-termscript FILE)

Documentation

Start writing all terminal output to FILE as well as the terminal.

FILE = nil means just close any termscript file currently open.

View in manual

Probably introduced at or before Emacs version 16.

Key Bindings

Source Code

// Defined in /usr/src/emacs/src/dispnew.c
{
  struct tty_display_info *tty;

  if (! FRAME_TERMCAP_P (SELECTED_FRAME ())
      && ! FRAME_MSDOS_P (SELECTED_FRAME ()))
    error ("Current frame is not on a tty device");

  tty = CURTTY ();

  if (tty->termscript != 0)
    {
      block_input ();
      fclose (tty->termscript);
      tty->termscript = 0;
      unblock_input ();
    }

  if (! NILP (file))
    {
      file = Fexpand_file_name (file, Qnil);
      tty->termscript = emacs_fopen (SSDATA (file), "w");
      if (tty->termscript == 0)
	report_file_error ("Opening termscript", file);
    }
  return Qnil;
}