Fix copyrights for javascript and python grammars.
[emacs.git] / src / w32console.c
blob49bf56ddee94e76c45c7a02509d49278316e5726
1 /* Terminal hooks for GNU Emacs on the Microsoft W32 API.
2 Copyright (C) 1992, 1999, 2001-2011 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
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
9 (at your option) any later version.
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.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 Tim Fleehart (apollo@online.com) 1-17-92
21 Geoff Voelker (voelker@cs.washington.edu) 9-12-93
25 #include <config.h>
27 #include <stdio.h>
28 #include <windows.h>
29 #include <setjmp.h>
31 #include "lisp.h"
32 #include "character.h"
33 #include "coding.h"
34 #include "disptab.h"
35 #include "frame.h"
36 #include "termhooks.h"
37 #include "termchar.h"
38 #include "dispextern.h"
39 #include "w32inevt.h"
41 /* from window.c */
42 extern Lisp_Object Frecenter (Lisp_Object);
44 static void w32con_move_cursor (struct frame *f, int row, int col);
45 static void w32con_clear_to_end (struct frame *f);
46 static void w32con_clear_frame (struct frame *f);
47 static void w32con_clear_end_of_line (struct frame *f, int);
48 static void w32con_ins_del_lines (struct frame *f, int vpos, int n);
49 static void w32con_insert_glyphs (struct frame *f, struct glyph *start, int len);
50 static void w32con_write_glyphs (struct frame *f, struct glyph *string, int len);
51 static void w32con_delete_glyphs (struct frame *f, int n);
52 static void w32con_reset_terminal_modes (struct terminal *t);
53 static void w32con_set_terminal_modes (struct terminal *t);
54 static void w32con_set_terminal_window (struct frame *f, int size);
55 static void w32con_update_begin (struct frame * f);
56 static void w32con_update_end (struct frame * f);
57 static WORD w32_face_attributes (struct frame *f, int face_id);
59 static COORD cursor_coords;
60 static HANDLE prev_screen, cur_screen;
61 static WORD char_attr_normal;
62 static DWORD prev_console_mode;
64 #ifndef USE_SEPARATE_SCREEN
65 static CONSOLE_CURSOR_INFO prev_console_cursor;
66 #endif
68 HANDLE keyboard_handle;
71 /* Setting this as the ctrl handler prevents emacs from being killed when
72 someone hits ^C in a 'suspended' session (child shell).
73 Also ignore Ctrl-Break signals. */
75 BOOL
76 ctrl_c_handler (unsigned long type)
78 /* Only ignore "interrupt" events when running interactively. */
79 return (!noninteractive
80 && (type == CTRL_C_EVENT || type == CTRL_BREAK_EVENT));
84 /* Move the cursor to (ROW, COL) on FRAME. */
85 static void
86 w32con_move_cursor (struct frame *f, int row, int col)
88 cursor_coords.X = col;
89 cursor_coords.Y = row;
91 /* TODO: for multi-tty support, cur_screen should be replaced with a
92 reference to the terminal for this frame. */
93 SetConsoleCursorPosition (cur_screen, cursor_coords);
96 /* Clear from cursor to end of screen. */
97 static void
98 w32con_clear_to_end (struct frame *f)
100 w32con_clear_end_of_line (f, FRAME_COLS (f) - 1);
101 w32con_ins_del_lines (f, cursor_coords.Y, FRAME_LINES (f) - cursor_coords.Y - 1);
104 /* Clear the frame. */
105 static void
106 w32con_clear_frame (struct frame *f)
108 COORD dest;
109 int n;
110 DWORD r;
111 CONSOLE_SCREEN_BUFFER_INFO info;
113 GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info);
115 /* Remember that the screen buffer might be wider than the window. */
116 n = FRAME_LINES (f) * info.dwSize.X;
117 dest.X = dest.Y = 0;
119 FillConsoleOutputAttribute (cur_screen, char_attr_normal, n, dest, &r);
120 FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r);
122 w32con_move_cursor (f, 0, 0);
126 static struct glyph glyph_base[256];
127 static BOOL ceol_initialized = FALSE;
129 /* Clear from Cursor to end (what's "standout marker"?). */
130 static void
131 w32con_clear_end_of_line (struct frame *f, int end)
133 if (!ceol_initialized)
135 int i;
136 for (i = 0; i < 256; i++)
138 memcpy (&glyph_base[i], &space_glyph, sizeof (struct glyph));
140 ceol_initialized = TRUE;
142 w32con_write_glyphs (f, glyph_base, end - cursor_coords.X); /* fencepost ? */
145 /* Insert n lines at vpos. if n is negative delete -n lines. */
146 static void
147 w32con_ins_del_lines (struct frame *f, int vpos, int n)
149 int i, nb;
150 SMALL_RECT scroll;
151 SMALL_RECT clip;
152 COORD dest;
153 CHAR_INFO fill;
155 if (n < 0)
157 scroll.Top = vpos - n;
158 scroll.Bottom = FRAME_LINES (f);
159 dest.Y = vpos;
161 else
163 scroll.Top = vpos;
164 scroll.Bottom = FRAME_LINES (f) - n;
165 dest.Y = vpos + n;
167 clip.Top = clip.Left = scroll.Left = 0;
168 clip.Right = scroll.Right = FRAME_COLS (f);
169 clip.Bottom = FRAME_LINES (f);
171 dest.X = 0;
173 fill.Char.AsciiChar = 0x20;
174 fill.Attributes = char_attr_normal;
176 ScrollConsoleScreenBuffer (cur_screen, &scroll, &clip, dest, &fill);
178 /* Here we have to deal with a w32 console flake: If the scroll
179 region looks like abc and we scroll c to a and fill with d we get
180 cbd... if we scroll block c one line at a time to a, we get cdd...
181 Emacs expects cdd consistently... So we have to deal with that
182 here... (this also occurs scrolling the same way in the other
183 direction. */
185 if (n > 0)
187 if (scroll.Bottom < dest.Y)
189 for (i = scroll.Bottom; i < dest.Y; i++)
191 w32con_move_cursor (f, i, 0);
192 w32con_clear_end_of_line (f, FRAME_COLS (f));
196 else
198 nb = dest.Y + (scroll.Bottom - scroll.Top) + 1;
200 if (nb < scroll.Top)
202 for (i = nb; i < scroll.Top; i++)
204 w32con_move_cursor (f, i, 0);
205 w32con_clear_end_of_line (f, FRAME_COLS (f));
210 cursor_coords.X = 0;
211 cursor_coords.Y = vpos;
214 #undef LEFT
215 #undef RIGHT
216 #define LEFT 1
217 #define RIGHT 0
219 static void
220 scroll_line (struct frame *f, int dist, int direction)
222 /* The idea here is to implement a horizontal scroll in one line to
223 implement delete and half of insert. */
224 SMALL_RECT scroll, clip;
225 COORD dest;
226 CHAR_INFO fill;
228 clip.Top = scroll.Top = clip.Bottom = scroll.Bottom = cursor_coords.Y;
229 clip.Left = 0;
230 clip.Right = FRAME_COLS (f);
232 if (direction == LEFT)
234 scroll.Left = cursor_coords.X + dist;
235 scroll.Right = FRAME_COLS (f) - 1;
237 else
239 scroll.Left = cursor_coords.X;
240 scroll.Right = FRAME_COLS (f) - dist - 1;
243 dest.X = cursor_coords.X;
244 dest.Y = cursor_coords.Y;
246 fill.Char.AsciiChar = 0x20;
247 fill.Attributes = char_attr_normal;
249 ScrollConsoleScreenBuffer (cur_screen, &scroll, &clip, dest, &fill);
253 /* If start is zero insert blanks instead of a string at start ?. */
254 static void
255 w32con_insert_glyphs (struct frame *f, register struct glyph *start,
256 register int len)
258 scroll_line (f, len, RIGHT);
260 /* Move len chars to the right starting at cursor_coords, fill with blanks */
261 if (start)
263 /* Print the first len characters of start, cursor_coords.X adjusted
264 by write_glyphs. */
266 w32con_write_glyphs (f, start, len);
268 else
270 w32con_clear_end_of_line (f, cursor_coords.X + len);
274 static void
275 w32con_write_glyphs (struct frame *f, register struct glyph *string,
276 register int len)
278 DWORD r;
279 WORD char_attr;
280 unsigned char *conversion_buffer;
281 struct coding_system *coding;
283 if (len <= 0)
284 return;
286 /* If terminal_coding does any conversion, use it, otherwise use
287 safe_terminal_coding. We can't use CODING_REQUIRE_ENCODING here
288 because it always return 1 if the member src_multibyte is 1. */
289 coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK
290 ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding);
291 /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
292 the tail. */
293 coding->mode &= ~CODING_MODE_LAST_BLOCK;
295 while (len > 0)
297 /* Identify a run of glyphs with the same face. */
298 int face_id = string->face_id;
299 int n;
301 for (n = 1; n < len; ++n)
302 if (string[n].face_id != face_id)
303 break;
305 /* Turn appearance modes of the face of the run on. */
306 char_attr = w32_face_attributes (f, face_id);
308 if (n == len)
309 /* This is the last run. */
310 coding->mode |= CODING_MODE_LAST_BLOCK;
311 conversion_buffer = encode_terminal_code (string, n, coding);
312 if (coding->produced > 0)
314 /* Set the attribute for these characters. */
315 if (!FillConsoleOutputAttribute (cur_screen, char_attr,
316 coding->produced, cursor_coords,
317 &r))
319 printf ("Failed writing console attributes: %d\n",
320 GetLastError ());
321 fflush (stdout);
324 /* Write the characters. */
325 if (!WriteConsoleOutputCharacter (cur_screen, conversion_buffer,
326 coding->produced, cursor_coords,
327 &r))
329 printf ("Failed writing console characters: %d\n",
330 GetLastError ());
331 fflush (stdout);
334 cursor_coords.X += coding->produced;
335 w32con_move_cursor (f, cursor_coords.Y, cursor_coords.X);
337 len -= n;
338 string += n;
343 static void
344 w32con_delete_glyphs (struct frame *f, int n)
346 /* delete chars means scroll chars from cursor_coords.X + n to
347 cursor_coords.X, anything beyond the edge of the screen should
348 come out empty... */
350 scroll_line (f, n, LEFT);
353 static unsigned int sound_type = 0xFFFFFFFF;
354 #define MB_EMACS_SILENT (0xFFFFFFFF - 1)
356 void
357 w32_sys_ring_bell (struct frame *f)
359 if (sound_type == 0xFFFFFFFF)
361 Beep (666, 100);
363 else if (sound_type == MB_EMACS_SILENT)
365 /* Do nothing. */
367 else
368 MessageBeep (sound_type);
371 DEFUN ("set-message-beep", Fset_message_beep, Sset_message_beep, 1, 1, 0,
372 doc: /* Set the sound generated when the bell is rung.
373 SOUND is 'asterisk, 'exclamation, 'hand, 'question, 'ok, or 'silent
374 to use the corresponding system sound for the bell. The 'silent sound
375 prevents Emacs from making any sound at all.
376 SOUND is nil to use the normal beep. */)
377 (Lisp_Object sound)
379 CHECK_SYMBOL (sound);
381 if (NILP (sound))
382 sound_type = 0xFFFFFFFF;
383 else if (EQ (sound, intern ("asterisk")))
384 sound_type = MB_ICONASTERISK;
385 else if (EQ (sound, intern ("exclamation")))
386 sound_type = MB_ICONEXCLAMATION;
387 else if (EQ (sound, intern ("hand")))
388 sound_type = MB_ICONHAND;
389 else if (EQ (sound, intern ("question")))
390 sound_type = MB_ICONQUESTION;
391 else if (EQ (sound, intern ("ok")))
392 sound_type = MB_OK;
393 else if (EQ (sound, intern ("silent")))
394 sound_type = MB_EMACS_SILENT;
395 else
396 sound_type = 0xFFFFFFFF;
398 return sound;
401 static void
402 w32con_reset_terminal_modes (struct terminal *t)
404 COORD dest;
405 CONSOLE_SCREEN_BUFFER_INFO info;
406 int n;
407 DWORD r;
409 /* Clear the complete screen buffer. This is required because Emacs
410 sets the cursor position to the top of the buffer, but there might
411 be other output below the bottom of the Emacs frame if the screen buffer
412 is larger than the window size. */
413 GetConsoleScreenBufferInfo (cur_screen, &info);
414 dest.X = 0;
415 dest.Y = 0;
416 n = info.dwSize.X * info.dwSize.Y;
418 FillConsoleOutputAttribute (cur_screen, char_attr_normal, n, dest, &r);
419 FillConsoleOutputCharacter (cur_screen, ' ', n, dest, &r);
420 /* Now that the screen is clear, put the cursor at the top. */
421 SetConsoleCursorPosition (cur_screen, dest);
423 #ifdef USE_SEPARATE_SCREEN
424 SetConsoleActiveScreenBuffer (prev_screen);
425 #else
426 SetConsoleCursorInfo (prev_screen, &prev_console_cursor);
427 #endif
429 SetConsoleMode (keyboard_handle, prev_console_mode);
432 static void
433 w32con_set_terminal_modes (struct terminal *t)
435 CONSOLE_CURSOR_INFO cci;
437 /* make cursor big and visible (100 on Win95 makes it disappear) */
438 cci.dwSize = 99;
439 cci.bVisible = TRUE;
440 (void) SetConsoleCursorInfo (cur_screen, &cci);
442 SetConsoleActiveScreenBuffer (cur_screen);
444 SetConsoleMode (keyboard_handle, ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT);
446 /* Initialize input mode: interrupt_input off, no flow control, allow
447 8 bit character input, standard quit char. */
448 Fset_input_mode (Qnil, Qnil, make_number (2), Qnil);
451 /* hmmm... perhaps these let us bracket screen changes so that we can flush
452 clumps rather than one-character-at-a-time...
454 we'll start with not moving the cursor while an update is in progress. */
455 static void
456 w32con_update_begin (struct frame * f)
460 static void
461 w32con_update_end (struct frame * f)
463 SetConsoleCursorPosition (cur_screen, cursor_coords);
466 static void
467 w32con_set_terminal_window (struct frame *f, int size)
471 /***********************************************************************
472 stubs from termcap.c
473 ***********************************************************************/
475 void
476 sys_tputs (char *str, int nlines, int (*outfun) (int))
480 char *
481 sys_tgetstr (char *cap, char **area)
483 return NULL;
487 /***********************************************************************
488 stubs from cm.c
489 ***********************************************************************/
491 struct tty_display_info *current_tty = NULL;
492 int cost = 0;
495 evalcost (int c)
497 return c;
501 cmputc (int c)
503 return c;
506 void
507 cmcheckmagic (struct tty_display_info *tty)
511 void
512 cmcostinit (struct tty_display_info *tty)
516 void
517 cmgoto (struct tty_display_info *tty, int row, int col)
521 void
522 Wcm_clear (struct tty_display_info *tty)
527 /***********************************************************************
528 Faces
529 ***********************************************************************/
532 /* Turn appearances of face FACE_ID on tty frame F on. */
534 static WORD
535 w32_face_attributes (struct frame *f, int face_id)
537 WORD char_attr;
538 struct face *face = FACE_FROM_ID (f, face_id);
540 xassert (face != NULL);
542 char_attr = char_attr_normal;
544 /* Reverse the default color if requested. If background and
545 foreground are specified, then they have been reversed already. */
546 if (face->tty_reverse_p)
547 char_attr = (char_attr & 0xff00) + ((char_attr & 0x000f) << 4)
548 + ((char_attr & 0x00f0) >> 4);
550 /* Before the terminal is properly initialized, all colors map to 0.
551 Don't try to resolve them. */
552 if (NILP (Vtty_defined_color_alist))
553 return char_attr;
555 /* Colors should be in the range 0...15 unless they are one of
556 FACE_TTY_DEFAULT_COLOR, FACE_TTY_DEFAULT_FG_COLOR or
557 FACE_TTY_DEFAULT_BG_COLOR. Other out of range colors are
558 invalid, so it is better to use the default color if they ever
559 get through to here. */
560 if (face->foreground >= 0 && face->foreground < 16)
561 char_attr = (char_attr & 0xfff0) + face->foreground;
563 if (face->background >= 0 && face->background < 16)
564 char_attr = (char_attr & 0xff0f) + (face->background << 4);
566 return char_attr;
569 void
570 initialize_w32_display (struct terminal *term)
572 CONSOLE_SCREEN_BUFFER_INFO info;
574 term->rif = 0; /* No window based redisplay on the console. */
575 term->cursor_to_hook = w32con_move_cursor;
576 term->raw_cursor_to_hook = w32con_move_cursor;
577 term->clear_to_end_hook = w32con_clear_to_end;
578 term->clear_frame_hook = w32con_clear_frame;
579 term->clear_end_of_line_hook = w32con_clear_end_of_line;
580 term->ins_del_lines_hook = w32con_ins_del_lines;
581 term->insert_glyphs_hook = w32con_insert_glyphs;
582 term->write_glyphs_hook = w32con_write_glyphs;
583 term->delete_glyphs_hook = w32con_delete_glyphs;
584 term->ring_bell_hook = w32_sys_ring_bell;
585 term->reset_terminal_modes_hook = w32con_reset_terminal_modes;
586 term->set_terminal_modes_hook = w32con_set_terminal_modes;
587 term->set_terminal_window_hook = w32con_set_terminal_window;
588 term->update_begin_hook = w32con_update_begin;
589 term->update_end_hook = w32con_update_end;
591 term->read_socket_hook = w32_console_read_socket;
592 term->mouse_position_hook = w32_console_mouse_position;
594 /* The following are not used on the console. */
595 term->frame_rehighlight_hook = 0;
596 term->frame_raise_lower_hook = 0;
597 term->set_vertical_scroll_bar_hook = 0;
598 term->condemn_scroll_bars_hook = 0;
599 term->redeem_scroll_bar_hook = 0;
600 term->judge_scroll_bars_hook = 0;
601 term->frame_up_to_date_hook = 0;
603 /* Initialize interrupt_handle. */
604 init_crit ();
606 /* Remember original console settings. */
607 keyboard_handle = GetStdHandle (STD_INPUT_HANDLE);
608 GetConsoleMode (keyboard_handle, &prev_console_mode);
610 prev_screen = GetStdHandle (STD_OUTPUT_HANDLE);
612 #ifdef USE_SEPARATE_SCREEN
613 cur_screen = CreateConsoleScreenBuffer (GENERIC_READ | GENERIC_WRITE,
614 0, NULL,
615 CONSOLE_TEXTMODE_BUFFER,
616 NULL);
618 if (cur_screen == INVALID_HANDLE_VALUE)
620 printf ("CreateConsoleScreenBuffer failed in ResetTerm\n");
621 printf ("LastError = 0x%lx\n", GetLastError ());
622 fflush (stdout);
623 exit (0);
625 #else
626 cur_screen = prev_screen;
627 GetConsoleCursorInfo (prev_screen, &prev_console_cursor);
628 #endif
630 /* Respect setting of LINES and COLUMNS environment variables. */
632 char * lines = getenv ("LINES");
633 char * columns = getenv ("COLUMNS");
635 if (lines != NULL && columns != NULL)
637 SMALL_RECT new_win_dims;
638 COORD new_size;
640 new_size.X = atoi (columns);
641 new_size.Y = atoi (lines);
643 GetConsoleScreenBufferInfo (cur_screen, &info);
645 /* Shrink the window first, so the buffer dimensions can be
646 reduced if necessary. */
647 new_win_dims.Top = 0;
648 new_win_dims.Left = 0;
649 new_win_dims.Bottom = min (new_size.Y, info.dwSize.Y) - 1;
650 new_win_dims.Right = min (new_size.X, info.dwSize.X) - 1;
651 SetConsoleWindowInfo (cur_screen, TRUE, &new_win_dims);
653 SetConsoleScreenBufferSize (cur_screen, new_size);
655 /* Set the window size to match the buffer dimension. */
656 new_win_dims.Top = 0;
657 new_win_dims.Left = 0;
658 new_win_dims.Bottom = new_size.Y - 1;
659 new_win_dims.Right = new_size.X - 1;
660 SetConsoleWindowInfo (cur_screen, TRUE, &new_win_dims);
664 GetConsoleScreenBufferInfo (cur_screen, &info);
666 char_attr_normal = info.wAttributes;
668 /* Determine if the info returned by GetConsoleScreenBufferInfo
669 is realistic. Old MS Telnet servers used to only fill out
670 the dwSize portion, even modern one fill the whole struct with
671 garbage when using non-MS telnet clients. */
672 if ((w32_use_full_screen_buffer
673 && (info.dwSize.Y < 20 || info.dwSize.Y > 100
674 || info.dwSize.X < 40 || info.dwSize.X > 200))
675 || (!w32_use_full_screen_buffer
676 && (info.srWindow.Bottom - info.srWindow.Top < 20
677 || info.srWindow.Bottom - info.srWindow.Top > 100
678 || info.srWindow.Right - info.srWindow.Left < 40
679 || info.srWindow.Right - info.srWindow.Left > 100)))
681 FRAME_LINES (SELECTED_FRAME ()) = 25;
682 SET_FRAME_COLS (SELECTED_FRAME (), 80);
685 else if (w32_use_full_screen_buffer)
687 FRAME_LINES (SELECTED_FRAME ()) = info.dwSize.Y; /* lines per page */
688 SET_FRAME_COLS (SELECTED_FRAME (), info.dwSize.X); /* characters per line */
690 else
692 /* Lines per page. Use buffer coords instead of buffer size. */
693 FRAME_LINES (SELECTED_FRAME ()) = 1 + info.srWindow.Bottom -
694 info.srWindow.Top;
695 /* Characters per line. Use buffer coords instead of buffer size. */
696 SET_FRAME_COLS (SELECTED_FRAME (), 1 + info.srWindow.Right -
697 info.srWindow.Left);
700 /* Setup w32_display_info structure for this frame. */
702 w32_initialize_display_info (build_string ("Console"));
707 DEFUN ("set-screen-color", Fset_screen_color, Sset_screen_color, 2, 2, 0,
708 doc: /* Set screen foreground and background colors.
710 Arguments should be indices between 0 and 15, see w32console.el. */)
711 (Lisp_Object foreground, Lisp_Object background)
713 char_attr_normal = XFASTINT (foreground) + (XFASTINT (background) << 4);
715 Frecenter (Qnil);
716 return Qt;
719 DEFUN ("get-screen-color", Fget_screen_color, Sget_screen_color, 0, 0, 0,
720 doc: /* Get color indices of the current screen foreground and background.
722 The colors are returned as a list of 2 indices (FOREGROUND BACKGROUND).
723 See w32console.el and `tty-defined-color-alist' for mapping of indices
724 to colors. */)
725 (void)
727 return Fcons (make_number (char_attr_normal & 0x000f),
728 Fcons (make_number ((char_attr_normal >> 4) & 0x000f), Qnil));
731 DEFUN ("set-cursor-size", Fset_cursor_size, Sset_cursor_size, 1, 1, 0,
732 doc: /* Set cursor size. */)
733 (Lisp_Object size)
735 CONSOLE_CURSOR_INFO cci;
736 cci.dwSize = XFASTINT (size);
737 cci.bVisible = TRUE;
738 (void) SetConsoleCursorInfo (cur_screen, &cci);
740 return Qt;
743 void
744 syms_of_ntterm (void)
746 DEFVAR_BOOL ("w32-use-full-screen-buffer",
747 w32_use_full_screen_buffer,
748 doc: /* Non-nil means make terminal frames use the full screen buffer dimensions.
749 This is desirable when running Emacs over telnet.
750 A value of nil means use the current console window dimensions; this
751 may be preferrable when working directly at the console with a large
752 scroll-back buffer. */);
753 w32_use_full_screen_buffer = 0;
755 defsubr (&Sset_screen_color);
756 defsubr (&Sget_screen_color);
757 defsubr (&Sset_cursor_size);
758 defsubr (&Sset_message_beep);