root/src/terminal.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. tset_param_alist
  2. ring_bell
  3. update_begin
  4. update_end
  5. set_terminal_window
  6. cursor_to
  7. raw_cursor_to
  8. clear_to_end
  9. clear_frame
  10. clear_end_of_line
  11. write_glyphs
  12. insert_glyphs
  13. delete_glyphs
  14. ins_del_lines
  15. decode_terminal
  16. decode_live_terminal
  17. decode_tty_terminal
  18. get_named_terminal
  19. allocate_terminal
  20. create_terminal
  21. delete_terminal
  22. delete_terminal_internal
  23. DEFUN
  24. DEFUN
  25. DEFUN
  26. DEFUN
  27. store_terminal_param
  28. DEFUN
  29. calculate_glyph_code_table
  30. terminal_glyph_code
  31. initial_free_frame_resources
  32. init_initial_terminal
  33. delete_initial_terminal
  34. syms_of_terminal

     1 /* Functions related to terminal devices.
     2    Copyright (C) 2005-2023 Free Software Foundation, Inc.
     3 
     4 This file is part of GNU Emacs.
     5 
     6 GNU Emacs is free software: you can redistribute it and/or modify
     7 it under the terms of the GNU General Public License as published by
     8 the Free Software Foundation, either version 3 of the License, or (at
     9 your option) any later version.
    10 
    11 GNU Emacs is distributed in the hope that it will be useful,
    12 but WITHOUT ANY WARRANTY; without even the implied warranty of
    13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14 GNU General Public License for more details.
    15 
    16 You should have received a copy of the GNU General Public License
    17 along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
    18 
    19 #include <config.h>
    20 
    21 #include "lisp.h"
    22 #include "character.h"
    23 #include "frame.h"
    24 #include "termchar.h"
    25 #include "termhooks.h"
    26 #include "keyboard.h"
    27 
    28 #if HAVE_STRUCT_UNIPAIR_UNICODE
    29 # include <errno.h>
    30 # include <linux/kd.h>
    31 # include <sys/ioctl.h>
    32 #endif
    33 
    34 /* Chain of all terminals currently in use.  */
    35 struct terminal *terminal_list;
    36 
    37 /* The first unallocated terminal id.  */
    38 static int next_terminal_id;
    39 
    40 /* The initial terminal device, created by initial_term_init.  */
    41 struct terminal *initial_terminal;
    42 
    43 static void delete_initial_terminal (struct terminal *);
    44 
    45 /* This setter is used only in this file, so it can be private.  */
    46 static void
    47 tset_param_alist (struct terminal *t, Lisp_Object val)
    48 {
    49   t->param_alist = val;
    50 }
    51 
    52 
    53 
    54 void
    55 ring_bell (struct frame *f)
    56 {
    57   if (!NILP (Vring_bell_function))
    58     {
    59       Lisp_Object function;
    60 
    61       /* Temporarily set the global variable to nil
    62          so that if we get an error, it stays nil
    63          and we don't call it over and over.
    64 
    65          We don't specbind it, because that would carefully
    66          restore the bad value if there's an error
    67          and make the loop of errors happen anyway.  */
    68 
    69       function = Vring_bell_function;
    70       Vring_bell_function = Qnil;
    71 
    72       call0 (function);
    73 
    74       Vring_bell_function = function;
    75     }
    76   else if (FRAME_TERMINAL (f)->ring_bell_hook)
    77     (*FRAME_TERMINAL (f)->ring_bell_hook) (f);
    78 }
    79 
    80 void
    81 update_begin (struct frame *f)
    82 {
    83   if (FRAME_TERMINAL (f)->update_begin_hook)
    84     (*FRAME_TERMINAL (f)->update_begin_hook) (f);
    85 }
    86 
    87 void
    88 update_end (struct frame *f)
    89 {
    90   if (FRAME_TERMINAL (f)->update_end_hook)
    91     (*FRAME_TERMINAL (f)->update_end_hook) (f);
    92 }
    93 
    94 /* Specify how many text lines, from the top of the window,
    95    should be affected by insert-lines and delete-lines operations.
    96    This, and those operations, are used only within an update
    97    that is bounded by calls to update_begin and update_end.  */
    98 
    99 void
   100 set_terminal_window (struct frame *f, int size)
   101 {
   102   if (FRAME_TERMINAL (f)->set_terminal_window_hook)
   103     (*FRAME_TERMINAL (f)->set_terminal_window_hook) (f, size);
   104 }
   105 
   106 /* Move cursor to row/column position VPOS/HPOS.  HPOS/VPOS are
   107    frame-relative coordinates.  */
   108 
   109 void
   110 cursor_to (struct frame *f, int vpos, int hpos)
   111 {
   112   if (FRAME_TERMINAL (f)->cursor_to_hook)
   113     (*FRAME_TERMINAL (f)->cursor_to_hook) (f, vpos, hpos);
   114 }
   115 
   116 /* Similar but don't take any account of the wasted characters.  */
   117 
   118 void
   119 raw_cursor_to (struct frame *f, int row, int col)
   120 {
   121   if (FRAME_TERMINAL (f)->raw_cursor_to_hook)
   122     (*FRAME_TERMINAL (f)->raw_cursor_to_hook) (f, row, col);
   123 }
   124 
   125 /* Erase operations.  */
   126 
   127 /* Clear from cursor to end of frame.  */
   128 void
   129 clear_to_end (struct frame *f)
   130 {
   131   if (FRAME_TERMINAL (f)->clear_to_end_hook)
   132     (*FRAME_TERMINAL (f)->clear_to_end_hook) (f);
   133 }
   134 
   135 /* Clear entire frame.  */
   136 
   137 void
   138 clear_frame (struct frame *f)
   139 {
   140   if (FRAME_TERMINAL (f)->clear_frame_hook)
   141     (*FRAME_TERMINAL (f)->clear_frame_hook) (f);
   142 }
   143 
   144 /* Clear from cursor to end of line.
   145    Assume that the line is already clear starting at column first_unused_hpos.
   146 
   147    Note that the cursor may be moved, on terminals lacking a `ce' string.  */
   148 
   149 void
   150 clear_end_of_line (struct frame *f, int first_unused_hpos)
   151 {
   152   if (FRAME_TERMINAL (f)->clear_end_of_line_hook)
   153     (*FRAME_TERMINAL (f)->clear_end_of_line_hook) (f, first_unused_hpos);
   154 }
   155 
   156 /* Output LEN glyphs starting at STRING at the nominal cursor position.
   157    Advance the nominal cursor over the text.  */
   158 
   159 void
   160 write_glyphs (struct frame *f, struct glyph *string, int len)
   161 {
   162   if (FRAME_TERMINAL (f)->write_glyphs_hook)
   163     (*FRAME_TERMINAL (f)->write_glyphs_hook) (f, string, len);
   164 }
   165 
   166 /* Insert LEN glyphs from START at the nominal cursor position.
   167 
   168    If start is zero, insert blanks instead of a string at start */
   169 
   170 void
   171 insert_glyphs (struct frame *f, struct glyph *start, int len)
   172 {
   173   if (len <= 0)
   174     return;
   175 
   176   if (FRAME_TERMINAL (f)->insert_glyphs_hook)
   177     (*FRAME_TERMINAL (f)->insert_glyphs_hook) (f, start, len);
   178 }
   179 
   180 /* Delete N glyphs at the nominal cursor position. */
   181 
   182 void
   183 delete_glyphs (struct frame *f, int n)
   184 {
   185   if (FRAME_TERMINAL (f)->delete_glyphs_hook)
   186     (*FRAME_TERMINAL (f)->delete_glyphs_hook) (f, n);
   187 }
   188 
   189 /* Insert N lines at vpos VPOS.  If N is negative, delete -N lines.  */
   190 
   191 void
   192 ins_del_lines (struct frame *f, int vpos, int n)
   193 {
   194   if (FRAME_TERMINAL (f)->ins_del_lines_hook)
   195     (*FRAME_TERMINAL (f)->ins_del_lines_hook) (f, vpos, n);
   196 }
   197 
   198 /* Return the terminal object specified by TERMINAL.  TERMINAL may
   199    be a terminal object, a frame, or nil for the terminal device of
   200    the current frame.  If TERMINAL is neither from the above or the
   201    resulting terminal object is deleted, return NULL.  */
   202 
   203 static struct terminal *
   204 decode_terminal (Lisp_Object terminal)
   205 {
   206   struct terminal *t;
   207 
   208   if (NILP (terminal))
   209     terminal = selected_frame;
   210   t = (TERMINALP (terminal)
   211        ? XTERMINAL (terminal)
   212        : FRAMEP (terminal) ? FRAME_TERMINAL (XFRAME (terminal)) : NULL);
   213   return t && t->name ? t : NULL;
   214 }
   215 
   216 /* Like above, but throw an error if TERMINAL is not valid or deleted.  */
   217 
   218 struct terminal *
   219 decode_live_terminal (Lisp_Object terminal)
   220 {
   221   struct terminal *t = decode_terminal (terminal);
   222 
   223   if (!t)
   224     wrong_type_argument (Qterminal_live_p, terminal);
   225   return t;
   226 }
   227 
   228 /* Like decode_terminal, but ensure that the resulting terminal object refers
   229    to a text-based terminal device.  */
   230 
   231 struct terminal *
   232 decode_tty_terminal (Lisp_Object terminal)
   233 {
   234   struct terminal *t = decode_live_terminal (terminal);
   235 
   236   return (t->type == output_termcap || t->type == output_msdos_raw) ? t : NULL;
   237 }
   238 
   239 /* Return an active (not suspended) text-based terminal device that uses
   240    the tty device with the given NAME, or NULL if the named terminal device
   241    is not opened.  */
   242 
   243 struct terminal *
   244 get_named_terminal (const char *name)
   245 {
   246   struct terminal *t;
   247 
   248   eassert (name);
   249 
   250   for (t = terminal_list; t; t = t->next_terminal)
   251     {
   252       if ((t->type == output_termcap || t->type == output_msdos_raw)
   253           && !strcmp (t->display_info.tty->name, name)
   254           && TERMINAL_ACTIVE_P (t))
   255         return t;
   256     }
   257   return NULL;
   258 }
   259 
   260 /* Allocate basically initialized terminal.  */
   261 
   262 static struct terminal *
   263 allocate_terminal (void)
   264 {
   265   return ALLOCATE_ZEROED_PSEUDOVECTOR (struct terminal, glyph_code_table,
   266                                        PVEC_TERMINAL);
   267 }
   268 
   269 /* Create a new terminal object of TYPE and add it to the terminal list.  RIF
   270    may be NULL if this terminal type doesn't support window-based redisplay.  */
   271 
   272 struct terminal *
   273 create_terminal (enum output_method type, struct redisplay_interface *rif)
   274 {
   275   struct terminal *terminal = allocate_terminal ();
   276   Lisp_Object terminal_coding, keyboard_coding;
   277 
   278   terminal->next_terminal = terminal_list;
   279   terminal_list = terminal;
   280   terminal->type = type;
   281   terminal->rif = rif;
   282   terminal->id = next_terminal_id++;
   283 
   284   terminal->keyboard_coding = xmalloc (sizeof (struct coding_system));
   285   terminal->terminal_coding = xmalloc (sizeof (struct coding_system));
   286 
   287   /* If default coding systems for the terminal and the keyboard are
   288      already defined, use them in preference to the defaults.  This is
   289      needed when Emacs runs in daemon mode.  */
   290   keyboard_coding =
   291     find_symbol_value (intern ("default-keyboard-coding-system"));
   292   if (NILP (keyboard_coding)
   293       || BASE_EQ (keyboard_coding, Qunbound)
   294       || NILP (Fcoding_system_p (keyboard_coding)))
   295     keyboard_coding = Qno_conversion;
   296   terminal_coding =
   297     find_symbol_value (intern ("default-terminal-coding-system"));
   298   if (NILP (terminal_coding)
   299       || BASE_EQ (terminal_coding, Qunbound)
   300       || NILP (Fcoding_system_p (terminal_coding)))
   301     terminal_coding = Qundecided;
   302 
   303   setup_coding_system (keyboard_coding, terminal->keyboard_coding);
   304   setup_coding_system (terminal_coding, terminal->terminal_coding);
   305 
   306   return terminal;
   307 }
   308 
   309 /* Low-level function to close all frames on a terminal, remove it
   310    from the terminal list and free its memory.  */
   311 
   312 void
   313 delete_terminal (struct terminal *terminal)
   314 {
   315   Lisp_Object tail, frame;
   316 
   317   /* Protect against recursive calls.  delete_frame calls the
   318      delete_terminal_hook when we delete our last frame.  */
   319   if (!terminal->name)
   320     return;
   321   xfree (terminal->name);
   322   terminal->name = NULL;
   323 
   324   /* Check for live frames that are still on this terminal.  */
   325   FOR_EACH_FRAME (tail, frame)
   326     {
   327       struct frame *f = XFRAME (frame);
   328       if (FRAME_LIVE_P (f) && f->terminal == terminal)
   329         {
   330           /* Pass Qnoelisp rather than Qt.  */
   331           delete_frame (frame, Qnoelisp);
   332         }
   333     }
   334 
   335   delete_terminal_internal (terminal);
   336 }
   337 
   338 void
   339 delete_terminal_internal (struct terminal *terminal)
   340 {
   341   struct terminal **tp;
   342 
   343   for (tp = &terminal_list; *tp != terminal; tp = &(*tp)->next_terminal)
   344     if (! *tp)
   345       emacs_abort ();
   346   *tp = terminal->next_terminal;
   347 
   348   xfree (terminal->keyboard_coding);
   349   terminal->keyboard_coding = NULL;
   350   xfree (terminal->terminal_coding);
   351   terminal->terminal_coding = NULL;
   352 
   353   if (terminal->kboard && --terminal->kboard->reference_count == 0)
   354     {
   355       delete_kboard (terminal->kboard);
   356       terminal->kboard = NULL;
   357     }
   358 }
   359 
   360 DEFUN ("delete-terminal", Fdelete_terminal, Sdelete_terminal, 0, 2, 0,
   361        doc: /* Delete TERMINAL by deleting all frames on it and closing the terminal.
   362 TERMINAL may be a terminal object, a frame, or nil (meaning the
   363 selected frame's terminal).
   364 
   365 Normally, you may not delete a display if all other displays are suspended,
   366 but if the second argument FORCE is non-nil, you may do so. */)
   367   (Lisp_Object terminal, Lisp_Object force)
   368 {
   369   struct terminal *t = decode_terminal (terminal);
   370 
   371   if (!t)
   372     return Qnil;
   373 
   374   if (NILP (force))
   375     {
   376       struct terminal *p = terminal_list;
   377       while (p && (p == t || !TERMINAL_ACTIVE_P (p)))
   378         p = p->next_terminal;
   379 
   380       if (!p)
   381         error ("Attempt to delete the sole active display terminal");
   382     }
   383 
   384   if (NILP (Vrun_hooks))
   385     ;
   386   else if (EQ (force, Qnoelisp))
   387     pending_funcalls
   388       = Fcons (list3 (Qrun_hook_with_args,
   389                       Qdelete_terminal_functions, terminal),
   390                pending_funcalls);
   391   else
   392     safe_call2 (Qrun_hook_with_args, Qdelete_terminal_functions, terminal);
   393 
   394   if (t->delete_terminal_hook)
   395     (*t->delete_terminal_hook) (t);
   396   else
   397     delete_terminal (t);
   398 
   399   return Qnil;
   400 }
   401 
   402 
   403 DEFUN ("frame-terminal", Fframe_terminal, Sframe_terminal, 0, 1, 0,
   404        doc: /* Return the terminal that FRAME is displayed on.
   405 If FRAME is nil, use the selected frame.
   406 
   407 The terminal device is represented by its integer identifier.  */)
   408   (Lisp_Object frame)
   409 {
   410   struct terminal *t = FRAME_TERMINAL (decode_live_frame (frame));
   411 
   412   if (!t)
   413     return Qnil;
   414   else
   415     {
   416       Lisp_Object terminal;
   417       XSETTERMINAL (terminal, t);
   418       return terminal;
   419     }
   420 }
   421 
   422 DEFUN ("terminal-live-p", Fterminal_live_p, Sterminal_live_p, 1, 1, 0,
   423        doc: /* Return non-nil if OBJECT is a terminal which has not been deleted.
   424 Return nil if OBJECT is not a live display terminal.
   425 OBJECT may be a terminal object, a frame, or nil (meaning the
   426 selected frame's terminal).
   427 If OBJECT is a live display terminal, return what sort of output
   428 terminal it uses.  See the documentation of `framep' for possible
   429 return values.  */)
   430   (Lisp_Object object)
   431 {
   432   struct terminal *t = decode_terminal (object);
   433 
   434   if (!t)
   435     return Qnil;
   436 
   437   switch (t->type)
   438     {
   439     case output_initial: /* The initial frame is like a termcap frame. */
   440     case output_termcap:
   441       return Qt;
   442     case output_x_window:
   443       return Qx;
   444     case output_w32:
   445       return Qw32;
   446     case output_msdos_raw:
   447       return Qpc;
   448     case output_ns:
   449       return Qns;
   450     case output_pgtk:
   451       return Qpgtk;
   452     case output_haiku:
   453       return Qhaiku;
   454     default:
   455       emacs_abort ();
   456     }
   457 }
   458 
   459 DEFUN ("terminal-list", Fterminal_list, Sterminal_list, 0, 0, 0,
   460        doc: /* Return a list of all terminal devices.  */)
   461   (void)
   462 {
   463   Lisp_Object terminal, terminals = Qnil;
   464   struct terminal *t;
   465 
   466   for (t = terminal_list; t; t = t->next_terminal)
   467     {
   468       XSETTERMINAL (terminal, t);
   469       terminals = Fcons (terminal, terminals);
   470     }
   471 
   472   return terminals;
   473 }
   474 
   475 DEFUN ("terminal-name", Fterminal_name, Sterminal_name, 0, 1, 0,
   476        doc: /* Return the name of the terminal device TERMINAL.
   477 It is not guaranteed that the returned value is unique among opened devices.
   478 
   479 TERMINAL may be a terminal object, a frame, or nil (meaning the
   480 selected frame's terminal). */)
   481   (Lisp_Object terminal)
   482 {
   483   struct terminal *t = decode_live_terminal (terminal);
   484 
   485   return t->name ? build_string (t->name) : Qnil;
   486 }
   487 
   488 
   489 
   490 /* Set the value of terminal parameter PARAMETER in terminal D to VALUE.
   491    Return the previous value.  */
   492 
   493 static Lisp_Object
   494 store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object value)
   495 {
   496   Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist);
   497   if (NILP (old_alist_elt))
   498     {
   499       tset_param_alist (t, Fcons (Fcons (parameter, value), t->param_alist));
   500       return Qnil;
   501     }
   502   else
   503     {
   504       Lisp_Object result = Fcdr (old_alist_elt);
   505       Fsetcdr (old_alist_elt, value);
   506       return result;
   507     }
   508 }
   509 
   510 
   511 DEFUN ("terminal-parameters", Fterminal_parameters, Sterminal_parameters, 0, 1, 0,
   512        doc: /* Return the parameter-alist of terminal TERMINAL.
   513 The value is a list of elements of the form (PARM . VALUE), where PARM
   514 is a symbol.
   515 
   516 TERMINAL can be a terminal object, a frame, or nil (meaning the
   517 selected frame's terminal).  */)
   518   (Lisp_Object terminal)
   519 {
   520   return Fcopy_alist (decode_live_terminal (terminal)->param_alist);
   521 }
   522 
   523 DEFUN ("terminal-parameter", Fterminal_parameter, Sterminal_parameter, 2, 2, 0,
   524        doc: /* Return TERMINAL's value for parameter PARAMETER.
   525 TERMINAL can be a terminal object, a frame, or nil (meaning the
   526 selected frame's terminal).  */)
   527   (Lisp_Object terminal, Lisp_Object parameter)
   528 {
   529   CHECK_SYMBOL (parameter);
   530   return Fcdr (Fassq (parameter, decode_live_terminal (terminal)->param_alist));
   531 }
   532 
   533 DEFUN ("set-terminal-parameter", Fset_terminal_parameter,
   534        Sset_terminal_parameter, 3, 3, 0,
   535        doc: /* Set TERMINAL's value for parameter PARAMETER to VALUE.
   536 Return the previous value of PARAMETER.
   537 
   538 TERMINAL can be a terminal object, a frame or nil (meaning the
   539 selected frame's terminal).  */)
   540   (Lisp_Object terminal, Lisp_Object parameter, Lisp_Object value)
   541 {
   542   return store_terminal_param (decode_live_terminal (terminal), parameter, value);
   543 }
   544 
   545 #if HAVE_STRUCT_UNIPAIR_UNICODE
   546 
   547 /* Compute the glyph code table for T.  */
   548 
   549 static void
   550 calculate_glyph_code_table (struct terminal *t)
   551 {
   552   Lisp_Object glyphtab = Qt;
   553   enum { initial_unipairs = 1000 };
   554   int entry_ct = initial_unipairs;
   555   struct unipair unipair_buffer[initial_unipairs];
   556   struct unipair *entries = unipair_buffer;
   557   struct unipair *alloced = 0;
   558 
   559   while (true)
   560     {
   561       int fd = fileno (t->display_info.tty->output);
   562       struct unimapdesc unimapdesc = { entry_ct, entries };
   563       if (ioctl (fd, GIO_UNIMAP, &unimapdesc) == 0)
   564         {
   565           glyphtab = Fmake_char_table (Qnil, make_fixnum (-1));
   566           for (int i = 0; i < unimapdesc.entry_ct; i++)
   567             char_table_set (glyphtab, entries[i].unicode,
   568                             make_fixnum (entries[i].fontpos));
   569           break;
   570         }
   571       if (errno != ENOMEM)
   572         break;
   573       entry_ct = unimapdesc.entry_ct;
   574       entries = alloced = xrealloc (alloced, entry_ct * sizeof *alloced);
   575     }
   576 
   577   xfree (alloced);
   578   t->glyph_code_table = glyphtab;
   579 }
   580 #endif
   581 
   582 /* Return the glyph code in T of character CH, or -1 if CH does not
   583    have a font position in T, or nil if T does not report glyph codes.  */
   584 
   585 Lisp_Object
   586 terminal_glyph_code (struct terminal *t, int ch)
   587 {
   588 #if HAVE_STRUCT_UNIPAIR_UNICODE
   589   /* Heuristically assume that a terminal supporting glyph codes is in
   590      UTF-8 mode if and only if its coding system is UTF-8 (Bug#26396).  */
   591   if (t->type == output_termcap
   592       && t->terminal_coding->encoder == encode_coding_utf_8)
   593     {
   594       /* As a hack, recompute the table when CH is the maximum
   595          character.  */
   596       if (NILP (t->glyph_code_table) || ch == MAX_CHAR)
   597         calculate_glyph_code_table (t);
   598 
   599       if (! EQ (t->glyph_code_table, Qt))
   600         return char_table_ref (t->glyph_code_table, ch);
   601     }
   602 #endif
   603 
   604   return Qnil;
   605 }
   606 
   607 /* Initial frame has no device-dependent output data, but has
   608    face cache which should be freed when the frame is deleted.  */
   609 
   610 static void
   611 initial_free_frame_resources (struct frame *f)
   612 {
   613   eassert (FRAME_INITIAL_P (f));
   614   free_frame_faces (f);
   615 }
   616 
   617 /* Create the bootstrap display terminal for the initial frame.
   618    Returns a terminal of type output_initial.  */
   619 
   620 struct terminal *
   621 init_initial_terminal (void)
   622 {
   623   if (initialized || terminal_list || tty_list)
   624     emacs_abort ();
   625 
   626   initial_terminal = create_terminal (output_initial, NULL);
   627   /* Note: menu-bar.el:menu-bar-update-buffers knows about this
   628      special name of the initial terminal.  */
   629   initial_terminal->name = xstrdup ("initial_terminal");
   630   initial_terminal->kboard = initial_kboard;
   631   initial_terminal->delete_terminal_hook = &delete_initial_terminal;
   632   initial_terminal->delete_frame_hook = &initial_free_frame_resources;
   633   initial_terminal->defined_color_hook = &tty_defined_color; /* xfaces.c */
   634   /* Other hooks are NULL by default.  */
   635 
   636   return initial_terminal;
   637 }
   638 
   639 /* Deletes the bootstrap terminal device.
   640    Called through delete_terminal_hook. */
   641 
   642 static void
   643 delete_initial_terminal (struct terminal *terminal)
   644 {
   645   if (terminal != initial_terminal)
   646     emacs_abort ();
   647 
   648   delete_terminal (terminal);
   649   initial_terminal = NULL;
   650 }
   651 
   652 void
   653 syms_of_terminal (void)
   654 {
   655 
   656   DEFVAR_LISP ("ring-bell-function", Vring_bell_function,
   657     doc: /* Non-nil means call this function to ring the bell.
   658 The function should accept no arguments.  */);
   659   Vring_bell_function = Qnil;
   660 
   661   DEFVAR_LISP ("delete-terminal-functions", Vdelete_terminal_functions,
   662     doc: /* Special hook run when a terminal is deleted.
   663 Each function is called with argument, the terminal.
   664 This may be called just before actually deleting the terminal,
   665 or some time later.  */);
   666   Vdelete_terminal_functions = Qnil;
   667 
   668   DEFSYM (Qterminal_live_p, "terminal-live-p");
   669   DEFSYM (Qdelete_terminal_functions, "delete-terminal-functions");
   670   DEFSYM (Qrun_hook_with_args, "run-hook-with-args");
   671 
   672   defsubr (&Sdelete_terminal);
   673   defsubr (&Sframe_terminal);
   674   defsubr (&Sterminal_live_p);
   675   defsubr (&Sterminal_list);
   676   defsubr (&Sterminal_name);
   677   defsubr (&Sterminal_parameters);
   678   defsubr (&Sterminal_parameter);
   679   defsubr (&Sset_terminal_parameter);
   680 
   681   Fprovide (intern_c_string ("multi-tty"), Qnil);
   682 }

/* [<][>][^][v][top][bottom][index][help] */