(ps-generate-postscript-with-faces):
[emacs.git] / lispref / display.texi
blob8545f23b8c29bb27cf227d4661e9cbcc579b60eb
1 @c -*-texinfo-*-
2 @c This is part of the GNU Emacs Lisp Reference Manual.
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. 
4 @c See the file elisp.texi for copying conditions.
5 @setfilename ../info/display
6 @node Display, Calendar, System Interface, Top
7 @chapter Emacs Display
9   This chapter describes a number of features related to the display
10 that Emacs presents to the user.
12 @menu
13 * Refresh Screen::      Clearing the screen and redrawing everything on it.
14 * Screen Size::         How big is the Emacs screen.
15 * Truncation::          Folding or wrapping long text lines.
16 * The Echo Area::       Where messages are displayed.
17 * Invisible Text::      Hiding part of the buffer text.
18 * Selective Display::   Hiding part of the buffer text (the old way).
19 * Overlay Arrow::       Display of an arrow to indicate position.
20 * Temporary Displays::  Displays that go away automatically.
21 * Overlays::            Use overlays to highlight parts of the buffer.
22 * Faces::               A face defines a graphics appearance: font, color, etc.
23 * Blinking::            How Emacs shows the matching open parenthesis.
24 * Inverse Video::       Specifying how the screen looks.
25 * Usual Display::       The usual conventions for displaying nonprinting chars.
26 * Display Tables::      How to specify other conventions.
27 * Beeping::             Audible signal to the user.
28 * Window Systems::      Which window system is being used.
29 @end menu
31 @node Refresh Screen
32 @section Refreshing the Screen
34 The function @code{redraw-frame} redisplays the entire contents of a
35 given frame.  @xref{Frames}.
37 @c Emacs 19 feature
38 @defun redraw-frame frame
39 This function clears and redisplays frame @var{frame}.
40 @end defun
42 Even more powerful is @code{redraw-display}:
44 @deffn Command redraw-display
45 This function clears and redisplays all visible frames.
46 @end deffn
48   Processing user input takes absolute priority over redisplay.  If you
49 call these functions when input is available, they do nothing
50 immediately, but a full redisplay does happen eventually---after all the
51 input has been processed.
53   Normally, suspending and resuming Emacs also refreshes the screen.
54 Some terminal emulators record separate contents for display-oriented
55 programs such as Emacs and for ordinary sequential display.  If you are
56 using such a terminal, you might want to inhibit the redisplay on
57 resumption.
59 @defvar no-redraw-on-reenter
60 @cindex suspend (cf. @code{no-redraw-on-reenter})
61 @cindex resume (cf. @code{no-redraw-on-reenter})
62 This variable controls whether Emacs redraws the entire screen after it
63 has been suspended and resumed.  Non-@code{nil} means yes, @code{nil}
64 means no.
65 @end defvar
67 @node Screen Size
68 @section Screen Size
69 @cindex size of screen
70 @cindex screen size
71 @cindex display lines
72 @cindex display columns
73 @cindex resize redisplay
75   The screen size functions access or specify the height or width of
76 the terminal.  When you are using multiple frames, they apply to the
77 selected frame (@pxref{Frames}).
79 @defun screen-height
80 This function returns the number of lines on the screen that are
81 available for display.
83 @example
84 @group
85 (screen-height)
86      @result{} 50
87 @end group
88 @end example
89 @end defun
91 @defun screen-width
92 This function returns the number of columns on the screen that are
93 available for display.
95 @example
96 @group
97 (screen-width)
98      @result{} 80
99 @end group
100 @end example
101 @end defun
103 @defun set-screen-height lines &optional not-actual-size
104 This function declares that the terminal can display @var{lines} lines.
105 The sizes of existing windows are altered proportionally to fit.
107 If @var{not-actual-size} is non-@code{nil}, then Emacs displays
108 @var{lines} lines of output, but does not change its value for the
109 actual height of the screen.  (Knowing the correct actual size may be
110 necessary for correct cursor positioning.)  Using a smaller height than
111 the terminal actually implements may be useful to reproduce behavior
112 observed on a smaller screen, or if the terminal malfunctions when using
113 its whole screen.
115 If @var{lines} is different from what it was previously, then the
116 entire screen is cleared and redisplayed using the new size.
118 This function returns @code{nil}.
119 @end defun
121 @defun set-screen-width columns &optional not-actual-size
122 This function declares that the terminal can display @var{columns}
123 columns.  The details are as in @code{set-screen-height}.
124 @end defun
126 @node Truncation
127 @section Truncation
128 @cindex line wrapping
129 @cindex continuation lines
130 @cindex @samp{$} in display
131 @cindex @samp{\} in display
133   When a line of text extends beyond the right edge of a window, the
134 line can either be continued on the next screen line, or truncated to
135 one screen line.  The additional screen lines used to display a long
136 text line are called @dfn{continuation} lines.  Normally, a @samp{$} in
137 the rightmost column of the window indicates truncation; a @samp{\} on
138 the rightmost column indicates a line that ``wraps'' or is continued
139 onto the next line.  (The display table can specify alternative
140 indicators; see @ref{Display Tables}.)
142   Note that continuation is different from filling; continuation happens
143 on the screen only, not in the buffer contents, and it breaks a line
144 precisely at the right margin, not at a word boundary.  @xref{Filling}.
146 @defopt truncate-lines
147 This buffer-local variable controls how Emacs displays lines that extend
148 beyond the right edge of the window.  The default is @code{nil}, which
149 specifies continuation.  If the value is non-@code{nil}, then these
150 lines are truncated.
152 If the variable @code{truncate-partial-width-windows} is non-@code{nil},
153 then truncation is always used for side-by-side windows (within one
154 frame) regardless of the value of @code{truncate-lines}.
155 @end defopt
157 @defopt default-truncate-lines
158 This variable is the default value for @code{truncate-lines}, for
159 buffers that do not have local values for it.
160 @end defopt
162 @defopt truncate-partial-width-windows
163 This variable controls display of lines that extend beyond the right
164 edge of the window, in side-by-side windows (@pxref{Splitting Windows}).
165 If it is non-@code{nil}, these lines are truncated; otherwise,
166 @code{truncate-lines} says what to do with them.
167 @end defopt
169   You can override the images that indicate continuation or truncation
170 with the display table; see @ref{Display Tables}.
172   If your buffer contains @strong{very} long lines, and you use
173 continuation to display them, just thinking about them can make Emacs
174 redisplay slow.  The column computation and indentation functions also
175 become slow.  Then you might find it advisable to set
176 @code{cache-long-line-scans} to @code{t}.
178 @defvar cache-long-line-scans
179 If this variable is non-@code{nil}, various indentation and motion
180 functions, and Emacs redisplay, cache the results of scanning the
181 buffer, and consult the cache to avoid rescanning regions of the buffer
182 unless they are modified.
184 Turning on the cache slows down processing of short lines somewhat.
186 This variable is automatically local in every buffer.
187 @end defvar
189 @node The Echo Area
190 @section The Echo Area
191 @cindex error display
192 @cindex echo area
194 The @dfn{echo area} is used for displaying messages made with the
195 @code{message} primitive, and for echoing keystrokes.  It is not the
196 same as the minibuffer, despite the fact that the minibuffer appears
197 (when active) in the same place on the screen as the echo area.  The
198 @cite{GNU Emacs Manual} specifies the rules for resolving conflicts
199 between the echo area and the minibuffer for use of that screen space
200 (@pxref{Minibuffer,, The Minibuffer, emacs, The GNU Emacs Manual}).
201 Error messages appear in the echo area; see @ref{Errors}.
203 You can write output in the echo area by using the Lisp printing
204 functions with @code{t} as the stream (@pxref{Output Functions}), or as
205 follows:
207 @defun message string &rest arguments
208 This function displays a one-line message in the echo area.  The
209 argument @var{string} is similar to a C language @code{printf} control
210 string.  See @code{format} in @ref{String Conversion}, for the details
211 on the conversion specifications.  @code{message} returns the
212 constructed string.
214 In batch mode, @code{message} prints the message text on the standard
215 error stream, followed by a newline.
217 @c Emacs 19 feature
218 If @var{string} is @code{nil}, @code{message} clears the echo area.  If
219 the minibuffer is active, this brings the minibuffer contents back onto
220 the screen immediately.
222 @example
223 @group
224 (message "Minibuffer depth is %d."
225          (minibuffer-depth))
226  @print{} Minibuffer depth is 0.
227 @result{} "Minibuffer depth is 0."
228 @end group
230 @group
231 ---------- Echo Area ----------
232 Minibuffer depth is 0.
233 ---------- Echo Area ----------
234 @end group
235 @end example
236 @end defun
238 Almost all the messages displayed in the echo area are also recorded
239 in the @samp{*Messages*} buffer.
241 @defopt message-log-max
242 This variable specifies how many lines to keep in the @samp{*Messages*}
243 buffer.  The value @code{t} means there is no limit on how many lines to
244 keep.  The value @code{nil} disables message logging entirely.  Here's
245 how to display a message and prevent it from being logged:
247 @example
248 (let (message-log-max)
249   (message @dots{}))
250 @end example
251 @end defopt
253 @defvar echo-keystrokes
254 This variable determines how much time should elapse before command
255 characters echo.  Its value must be an integer, which specifies the
256 number of seconds to wait before echoing.  If the user types a prefix
257 key (such as @kbd{C-x}) and then delays this many seconds before
258 continuing, the prefix key is echoed in the echo area.  Any subsequent
259 characters in the same command will be echoed as well.
261 If the value is zero, then command input is not echoed.
262 @end defvar
264 @defvar cursor-in-echo-area
265 This variable controls where the cursor appears when a message is
266 displayed in the echo area.  If it is non-@code{nil}, then the cursor
267 appears at the end of the message.  Otherwise, the cursor appears at
268 point---not in the echo area at all.
270 The value is normally @code{nil}; Lisp programs bind it to @code{t}
271 for brief periods of time.
272 @end defvar
274 @node Invisible Text
275 @section Invisible Text
277 @cindex invisible text
278 You can make characters @dfn{invisible}, so that they do not appear on
279 the screen, with the @code{invisible} property.  This can be either a
280 text property or a property of an overlay.
282 In the simplest case, any non-@code{nil} @code{invisible} property makes
283 a character invisible.  This is the default case---if you don't alter
284 the default value of @code{buffer-invisibility-spec}, this is how the
285 @code{invisibility} property works.  This feature is much like selective
286 display (@pxref{Selective Display}), but more general and cleaner.
288 More generally, you can use the variable @code{buffer-invisibility-spec}
289 to control which values of the @code{invisible} property make text
290 invisible.  This permits you to classify the text into different subsets
291 in advance, by giving them different @code{invisible} values, and
292 subsequently make various subsets visible or invisible by changing the
293 value of @code{buffer-invisibility-spec}.
295 Controlling visibility with @code{buffer-invisibility-spec} is
296 especially useful in a program to display the list of entries in a data
297 base.  It permits the implementation of convenient filtering commands to
298 view just a part of the entries in the data base.  Setting this variable
299 is very fast, much faster than scanning all the text in the buffer
300 looking for properties to change.
302 @defvar buffer-invisibility-spec
303 This variable specifies which kinds of @code{invisible} properties
304 actually make a character invisible.
306 @table @asis
307 @item @code{t}
308 A character is invisible if its @code{invisible} property is
309 non-@code{nil}.  This is the default.
311 @item a list
312 Each element of the list makes certain characters invisible.
313 Ultimately, a character is invisible if any of the elements of this list
314 applies to it.  The list can have two kinds of elements:
316 @table @code
317 @item @var{atom}
318 A character is invisible if its @code{invisible} propery value
319 is @var{atom} or if it is a list with @var{atom} as a member.
321 @item (@var{atom} . t)
322 A character is invisible if its @code{invisible} propery value
323 is @var{atom} or if it is a list with @var{atom} as a member.
324 Moreover, if this character is at the end of a line and is followed
325 by a visible newline, it displays an ellipsis.
326 @end table
327 @end table
328 @end defvar
330   Ordinarily, commands that operate on text or move point do not care
331 whether the text is invisible.  However, the user-level line motion
332 commands explicitly ignore invisible newlines.
334 @node Selective Display
335 @section Selective Display
336 @cindex selective display
338   @dfn{Selective display} is a pair of features that hide certain
339 lines on the screen.
341   The first variant, explicit selective display, is designed for use in
342 a Lisp program.  The program controls which lines are hidden by altering
343 the text.  Outline mode has traditionally used this variant.  It has
344 been partially replaced by the invisible text feature (@pxref{Invisible
345 Text}); there is a new version of Outline mode which uses that instead.
347   In the second variant, the choice of lines to hide is made
348 automatically based on indentation.  This variant is designed to be a
349 user-level feature.
351   The way you control explicit selective display is by replacing a
352 newline (control-j) with a carriage return (control-m).  The text that
353 was formerly a line following that newline is now invisible.  Strictly
354 speaking, it is temporarily no longer a line at all, since only newlines
355 can separate lines; it is now part of the previous line.
357   Selective display does not directly affect editing commands.  For
358 example, @kbd{C-f} (@code{forward-char}) moves point unhesitatingly into
359 invisible text.  However, the replacement of newline characters with
360 carriage return characters affects some editing commands.  For example,
361 @code{next-line} skips invisible lines, since it searches only for
362 newlines.  Modes that use selective display can also define commands
363 that take account of the newlines, or that make parts of the text
364 visible or invisible.
366   When you write a selectively displayed buffer into a file, all the
367 control-m's are output as newlines.  This means that when you next read
368 in the file, it looks OK, with nothing invisible.  The selective display
369 effect is seen only within Emacs.
371 @defvar selective-display
372 This buffer-local variable enables selective display.  This means that
373 lines, or portions of lines, may be made invisible.  
375 @itemize @bullet
376 @item
377 If the value of @code{selective-display} is @code{t}, then any portion
378 of a line that follows a control-m is not displayed.
380 @item
381 If the value of @code{selective-display} is a positive integer, then
382 lines that start with more than that many columns of indentation are not
383 displayed.
384 @end itemize
386 When some portion of a buffer is invisible, the vertical movement
387 commands operate as if that portion did not exist, allowing a single
388 @code{next-line} command to skip any number of invisible lines.
389 However, character movement commands (such as @code{forward-char}) do
390 not skip the invisible portion, and it is possible (if tricky) to insert
391 or delete text in an invisible portion.
393 In the examples below, we show the @emph{display appearance} of the
394 buffer @code{foo}, which changes with the value of
395 @code{selective-display}.  The @emph{contents} of the buffer do not
396 change.
398 @example
399 @group
400 (setq selective-display nil)
401      @result{} nil
403 ---------- Buffer: foo ----------
404 1 on this column
405  2on this column
406   3n this column
407   3n this column
408  2on this column
409 1 on this column
410 ---------- Buffer: foo ----------
411 @end group
413 @group
414 (setq selective-display 2)
415      @result{} 2
417 ---------- Buffer: foo ----------
418 1 on this column
419  2on this column
420  2on this column
421 1 on this column
422 ---------- Buffer: foo ----------
423 @end group
424 @end example
425 @end defvar
427 @defvar selective-display-ellipses
428 If this buffer-local variable is non-@code{nil}, then Emacs displays
429 @samp{@dots{}} at the end of a line that is followed by invisible text.
430 This example is a continuation of the previous one.
432 @example
433 @group
434 (setq selective-display-ellipses t)
435      @result{} t
437 ---------- Buffer: foo ----------
438 1 on this column
439  2on this column ...
440  2on this column
441 1 on this column
442 ---------- Buffer: foo ----------
443 @end group
444 @end example
446 You can use a display table to substitute other text for the ellipsis
447 (@samp{@dots{}}).  @xref{Display Tables}.
448 @end defvar
450 @node Overlay Arrow
451 @section The Overlay Arrow
452 @cindex overlay arrow
454   The @dfn{overlay arrow} is useful for directing the user's attention
455 to a particular line in a buffer.  For example, in the modes used for
456 interface to debuggers, the overlay arrow indicates the line of code
457 about to be executed.
459 @defvar overlay-arrow-string
460 This variable holds the string to display to call attention to a
461 particular line, or @code{nil} if the arrow feature is not in use.
462 @end defvar
464 @defvar overlay-arrow-position
465 This variable holds a marker that indicates where to display the overlay
466 arrow.  It should point at the beginning of a line.  The arrow text
467 appears at the beginning of that line, overlaying any text that would
468 otherwise appear.  Since the arrow is usually short, and the line
469 usually begins with indentation, normally nothing significant is
470 overwritten.
472 The overlay string is displayed only in the buffer that this marker
473 points into.  Thus, only one buffer can have an overlay arrow at any
474 given time.
475 @c !!! overlay-arrow-position: but the overlay string may remain in the display
476 @c of some other buffer until an update is required.  This should be fixed
477 @c now.  Is it?
478 @end defvar
480   You can do the same job by creating an overlay with a
481 @code{before-string} property.  @xref{Overlay Properties}.
483 @node Temporary Displays
484 @section Temporary Displays
486   Temporary displays are used by commands to put output into a buffer
487 and then present it to the user for perusal rather than for editing.
488 Many of the help commands use this feature.
490 @defspec with-output-to-temp-buffer buffer-name forms@dots{}
491 This function executes @var{forms} while arranging to insert any
492 output they print into the buffer named @var{buffer-name}.  The buffer
493 is then shown in some window for viewing, displayed but not selected.
495 The string @var{buffer-name} specifies the temporary buffer, which
496 need not already exist.  The argument must be a string, not a buffer.
497 The buffer is erased initially (with no questions asked), and it is
498 marked as unmodified after @code{with-output-to-temp-buffer} exits.
500 @code{with-output-to-temp-buffer} binds @code{standard-output} to the
501 temporary buffer, then it evaluates the forms in @var{forms}.  Output
502 using the Lisp output functions within @var{forms} goes by default to
503 that buffer (but screen display and messages in the echo area, although
504 they are ``output'' in the general sense of the word, are not affected).
505 @xref{Output Functions}.
507 The value of the last form in @var{forms} is returned.
509 @example
510 @group
511 ---------- Buffer: foo ----------
512  This is the contents of foo.
513 ---------- Buffer: foo ----------
514 @end group
516 @group
517 (with-output-to-temp-buffer "foo"
518     (print 20)
519     (print standard-output))
520 @result{} #<buffer foo>
522 ---------- Buffer: foo ----------
525 #<buffer foo>
527 ---------- Buffer: foo ----------
528 @end group
529 @end example
530 @end defspec
532 @defvar temp-buffer-show-function
533 If this variable is non-@code{nil}, @code{with-output-to-temp-buffer}
534 calls it as a function to do the job of displaying a help buffer.  The
535 function gets one argument, which is the buffer it should display.
537 In Emacs versions 18 and earlier, this variable was called
538 @code{temp-buffer-show-hook}.
539 @end defvar
541 @defun momentary-string-display string position &optional char message
542 This function momentarily displays @var{string} in the current buffer at
543 @var{position}.  It has no effect on the undo list or on the buffer's
544 modification status.
546 The momentary display remains until the next input event.  If the next
547 input event is @var{char}, @code{momentary-string-display} ignores it
548 and returns.  Otherwise, that event remains buffered for subsequent use
549 as input.  Thus, typing @var{char} will simply remove the string from
550 the display, while typing (say) @kbd{C-f} will remove the string from
551 the display and later (presumably) move point forward.  The argument
552 @var{char} is a space by default.
554 The return value of @code{momentary-string-display} is not meaningful.
556 If the string @var{string} does not contain control characters, you can
557 do the same job in a more general way by creating an overlay with a
558 @code{before-string} property.  @xref{Overlay Properties}.
560 If @var{message} is non-@code{nil}, it is displayed in the echo area
561 while @var{string} is displayed in the buffer.  If it is @code{nil}, a
562 default message says to type @var{char} to continue.
564 In this example, point is initially located at the beginning of the
565 second line:
567 @example
568 @group
569 ---------- Buffer: foo ----------
570 This is the contents of foo.
571 @point{}Second line.
572 ---------- Buffer: foo ----------
573 @end group
575 @group
576 (momentary-string-display
577   "**** Important Message! ****"
578   (point) ?\r
579   "Type RET when done reading")
580 @result{} t
581 @end group
583 @group
584 ---------- Buffer: foo ----------
585 This is the contents of foo.
586 **** Important Message! ****Second line.
587 ---------- Buffer: foo ----------
589 ---------- Echo Area ----------
590 Type RET when done reading
591 ---------- Echo Area ----------
592 @end group
593 @end example
594 @end defun
596 @node Overlays
597 @section Overlays
598 @cindex overlays
600 You can use @dfn{overlays} to alter the appearance of a buffer's text on
601 the screen, for the sake of presentation features.  An overlay is an
602 object that belongs to a particular buffer, and has a specified
603 beginning and end.  It also has properties that you can examine and set;
604 these affect the display of the text within the overlay.
606 @menu
607 * Overlay Properties::  How to read and set properties.
608                         What properties do to the screen display.
609 * Managing Overlays::   Creating, moving, finding overlays.
610 @end menu
612 @node Overlay Properties
613 @subsection Overlay Properties
615 Overlay properties are like text properties in some respects, but the
616 differences are more important than the similarities.  Text properties
617 are considered a part of the text; overlays are specifically considered
618 not to be part of the text.  Thus, copying text between various buffers
619 and strings preserves text properties, but does not try to preserve
620 overlays.  Changing a buffer's text properties marks the buffer as
621 modified, while moving an overlay or changing its properties does not.
622 Unlike text propery changes, overlay changes are not recorded in the
623 buffer's undo list.
625 @table @code
626 @item priority
627 @kindex priority @r{(overlay property)}
628 This property's value (which should be a nonnegative number) determines
629 the priority of the overlay.  The priority matters when two or more
630 overlays cover the same character and both specify a face for display;
631 the one whose @code{priority} value is larger takes priority over the
632 other, and its face attributes override the face attributes of the lower
633 priority overlay.
635 Currently, all overlays take priority over text properties.  Please
636 avoid using negative priority values, as we have not yet decided just
637 what they should mean.
639 @item window
640 @kindex window @r{(overlay property)}
641 If the @code{window} property is non-@code{nil}, then the overlay
642 applies only on that window.
644 @item category
645 @kindex category @r{(overlay property)}
646 If an overlay has a @code{category} property, we call it the
647 @dfn{category} of the overlay.  It should be a symbol.  The properties
648 of the symbol serve as defaults for the properties of the overlay.
650 @item face
651 @kindex face @r{(overlay property)}
652 This property controls the font and color of text.  Its value is a face
653 name or a list of face names.  @xref{Faces}, for more information.  This
654 feature may be temporary; in the future, we may replace it with other
655 ways of specifying how to display text.
657 @item mouse-face
658 @kindex mouse-face @r{(overlay property)}
659 This property is used instead of @code{face} when the mouse is within
660 the range of the overlay.  This feature may be temporary, like
661 @code{face}.
663 @item modification-hooks
664 @kindex modification-hooks @r{(overlay property)}
665 This property's value is a list of functions to be called if any
666 character within the overlay is changed or if text is inserted strictly
667 within the overlay.
669 The hook functions are called both before and after each change.
670 If the functions save the information they receive, and compare notes
671 between calls, they can determine exactly what change has been made
672 in the buffer text.
674 When called before a change, each function receives four arguments: the
675 overlay, @code{nil}, and the beginning and end of the text range to be
676 modified.
678 When called after a change, each function receives five arguments: the
679 overlay, @code{t}, the beginning and end of the text range just
680 modified, and the length of the pre-change text replaced by that range.
681 (For an insertion, the pre-change length is zero; for a deletion, that
682 length is the number of characters deleted, and the post-change
683 beginning and end are equal.)
685 @item insert-in-front-hooks
686 @kindex insert-in-front-hooks @r{(overlay property)}
687 This property's value is a list of functions to be called before and
688 after inserting text right at the beginning of the overlay.  The calling
689 conventions are the same as for the @code{modification-hooks} functions.
691 @item insert-behind-hooks
692 @kindex insert-behind-hooks @r{(overlay property)}
693 This property's value is a list of functions to be called before and
694 after inserting text right at the end of the overlay.  The calling
695 conventions are the same as for the @code{modification-hooks} functions.
697 @item invisible
698 @kindex invisible @r{(overlay property)}
699 The @code{invisible} property can make the text in the overlay
700 invisible, which means that it does not appear on the screen.
701 @xref{Invisible Text}, for details.
703 @item intangible
704 @kindex intangible @r{(overlay property)}
705 The @code{intangible} property on an overlay works just like the
706 @code{intangible} text property.  @xref{Special Properties}, for details.
708 @item before-string
709 @kindex before-string @r{(overlay property)}
710 This property's value is a string to add to the display at the beginning
711 of the overlay.  The string does not appear in the buffer in any
712 sense---only on the screen.  The string should contain only characters
713 that display as a single column---control characters, including tabs or
714 newlines, will give strange results.
716 @item after-string
717 @kindex after-string @r{(overlay property)}
718 This property's value is a string to add to the display at the end of
719 the overlay.  The string does not appear in the buffer in any
720 sense---only on the screen.  The string should contain only characters
721 that display as a single column---control characters, including tabs or
722 newlines, will give strange results.
724 @item evaporate
725 @kindex evaporate @r{(overlay property)}
726 If this property is non-@code{nil}, the overlay is deleted automatically
727 if it ever becomes empty (i.e., if it spans no characters).
728 @end table
730   These are the functions for reading and writing the properties of an
731 overlay.
733 @defun overlay-get overlay prop
734 This function returns the value of property @var{prop} recorded in
735 @var{overlay}, if any.  If @var{overlay} does not record any value for
736 that property, but it does have a @code{category} property which is a
737 symbol, that symbol's @var{prop} property is used.  Otherwise, the value
738 is @code{nil}.
739 @end defun
741 @defun overlay-put overlay prop value
742 This function sets the value of property @var{prop} recorded in
743 @var{overlay} to @var{value}.  It returns @var{value}.
744 @end defun
746   See also the function @code{get-char-property} which checks both
747 overlay properties and text properties for a given character.
748 @xref{Examining Properties}.
750 @node Managing Overlays
751 @subsection Managing Overlays
753   This section describes the functions to create, delete and move
754 overlays, and to examine their contents.
756 @defun make-overlay start end &optional buffer
757 This function creates and returns an overlay that belongs to
758 @var{buffer} and ranges from @var{start} to @var{end}.  Both @var{start}
759 and @var{end} must specify buffer positions; they may be integers or
760 markers.  If @var{buffer} is omitted, the overlay is created in the
761 current buffer.
762 @end defun
764 @defun overlay-start overlay
765 This function returns the position at which @var{overlay} starts.
766 @end defun
768 @defun overlay-end overlay
769 This function returns the position at which @var{overlay} ends.
770 @end defun
772 @defun overlay-buffer overlay
773 This function returns the buffer that @var{overlay} belongs to.
774 @end defun
776 @defun delete-overlay overlay
777 This function deletes @var{overlay}.  The overlay continues to exist as
778 a Lisp object, but ceases to be part of the buffer it belonged to, and
779 ceases to have any effect on display.
780 @end defun
782 @defun move-overlay overlay start end &optional buffer
783 This function moves @var{overlay} to @var{buffer}, and places its bounds
784 at @var{start} and @var{end}.  Both arguments @var{start} and @var{end}
785 must specify buffer positions; they may be integers or markers.  If
786 @var{buffer} is omitted, the overlay stays in the same buffer.
788 The return value is @var{overlay}.
790 This is the only valid way to change the endpoints of an overlay.  Do
791 not try modifying the markers in the overlay by hand, as that fails to
792 update other vital data structures and can cause some overlays to be
793 ``lost''.
794 @end defun
796 @defun overlays-at pos
797 This function returns a list of all the overlays that contain position
798 @var{pos} in the current buffer.  The list is in no particular order.
799 An overlay contains position @var{pos} if it begins at or before
800 @var{pos}, and ends after @var{pos}.
801 @end defun
803 @defun next-overlay-change pos
804 This function returns the buffer position of the next beginning or end
805 of an overlay, after @var{pos}.
806 @end defun
808 @defun previous-overlay-change pos
809 This function returns the buffer position of the previous beginning or
810 end of an overlay, before @var{pos}.
811 @end defun
813 @node Faces
814 @section Faces
815 @cindex face
817 A @dfn{face} is a named collection of graphical attributes: font,
818 foreground color, background color and optional underlining.  Faces
819 control the display of text on the screen.
821 @cindex face id
822 Each face has its own @dfn{face id number} which distinguishes faces at
823 low levels within Emacs.  However, for most purposes, you can refer to
824 faces in Lisp programs by their names.
826 @defun facep object
827 This function returns @code{t} if @var{object} is a face name symbol (or
828 if it is a vector of the kind used internally to record face data).  It
829 returns @code{nil} otherwise.
830 @end defun
832 Each face name is meaningful for all frames, and by default it has the
833 same meaning in all frames.  But you can arrange to give a particular
834 face name a special meaning in one frame if you wish.
836 @menu
837 * Standard Faces::      The faces Emacs normally comes with.
838 * Merging Faces::       How Emacs decides which face to use for a character.
839 * Face Functions::      How to define and examine faces.
840 @end menu
842 @node Standard Faces
843 @subsection Standard Faces
845   This table lists all the standard faces and their uses.
847 @table @code
848 @item default
849 @kindex default @r{(face name)}
850 This face is used for ordinary text.
852 @item modeline
853 @kindex modeline @r{(face name)}
854 This face is used for mode lines and menu bars.
856 @item region
857 @kindex region @r{(face name)}
858 This face is used for highlighting the region in Transient Mark mode.
860 @item secondary-selection
861 @kindex secondary-selection @r{(face name)}
862 This face is used to show any secondary selection you have made.
864 @item highlight
865 @kindex highlight @r{(face name)}
866 This face is meant to be used for highlighting for various purposes.
868 @item underline
869 @kindex underline @r{(face name)}
870 This face underlines text.
872 @item bold
873 @kindex bold @r{(face name)}
874 This face uses a bold font, if possible.  It uses the bold variant of
875 the frame's font, if it has one.  It's up to you to choose a default
876 font that has a bold variant, if you want to use one.
878 @item italic
879 @kindex italic @r{(face name)}
880 This face uses the italic variant of the frame's font, if it has one.
882 @item bold-italic
883 @kindex bold-italic @r{(face name)}
884 This face uses the bold italic variant of the frame's font, if it has
885 one.
886 @end table
888 @node Merging Faces
889 @subsection Merging Faces for Display
891   Here are all the ways to specify which face to use for display of text:
893 @itemize @bullet
894 @item
895 With defaults.  Each frame has a @dfn{default face}, whose id number is
896 zero, which is used for all text that doesn't somehow specify another
897 face.
899 @item
900 With text properties.  A character may have a @code{face} property; if so,
901 it is displayed with that face.  @xref{Special Properties}.
903 If the character has a @code{mouse-face} property, that is used instead
904 of the @code{face} property when the mouse is ``near enough'' to the
905 character.
907 @item
908 With overlays.  An overlay may have @code{face} and @code{mouse-face}
909 properties too; they apply to all the text covered by the overlay.
911 @item
912 With a region that is active.  In Transient Mark mode, the region is
913 highlighted with a particular face (see @code{region-face}, below).
915 @item
916 With special glyphs.  Each glyph can specify a particular face id
917 number.  @xref{Glyphs}.
918 @end itemize
920   If these various sources together specify more than one face for a
921 particular character, Emacs merges the attributes of the various faces
922 specified.  The attributes of the faces of special glyphs come first;
923 then comes the face for region highlighting, if appropriate;
924 then come attributes of faces from overlays, followed by those from text
925 properties, and last the default face.
927   When multiple overlays cover one character, an overlay with higher
928 priority overrides those with lower priority.  @xref{Overlays}.
930   If an attribute such as the font or a color is not specified in any of
931 the above ways, the frame's own font or color is used.
933 @node Face Functions
934 @subsection Functions for Working with Faces
936   The attributes a face can specify include the font, the foreground
937 color, the background color, and underlining.  The face can also leave
938 these unspecified by giving the value @code{nil} for them.
940   Here are the primitives for creating and changing faces.
942 @defun make-face name
943 This function defines a new face named @var{name}, initially with all
944 attributes @code{nil}.  It does nothing if there is already a face named
945 @var{name}.
946 @end defun
948 @defun face-list
949 This function returns a list of all defined face names.
950 @end defun
952 @defun copy-face old-face new-name &optional frame new-frame
953 This function defines the face @var{new-name} as a copy of the existing
954 face named @var{old-face}.  It creates the face @var{new-name} if that
955 doesn't already exist.
957 If the optional argument @var{frame} is given, this function applies
958 only to that frame.  Otherwise it applies to each frame individually,
959 copying attributes from @var{old-face} in each frame to @var{new-face}
960 in the same frame.
962 If the optional argument @var{new-frame} is given, then @code{copy-face}
963 copies the attributes of @var{old-face} in @var{frame} to @var{new-name}
964 in @var{new-frame}.
965 @end defun
967   You can modify the attributes of an existing face with the following
968 functions.  If you specify @var{frame}, they affect just that frame;
969 otherwise, they affect all frames as well as the defaults that apply to
970 new frames.
972 @defun set-face-foreground face color &optional frame
973 @defunx set-face-background face color &optional frame
974 These functions set the foreground (or background, respectively) color
975 of face @var{face} to @var{color}.  The argument @var{color} should be a
976 string, the name of a color.
978 Certain shades of gray are implemented by stipple patterns on
979 black-and-white screens.
980 @end defun
982 @defun set-face-stipple face pattern &optional frame
983 This function sets the background stipple pattern of face @var{face} to
984 @var{pattern}.  The argument @var{pattern} should be the name of a
985 stipple pattern defined by the X server, or @code{nil} meaning don't use
986 stipple.
988 Normally there is no need to pay attention to stipple patterns, because
989 they are used automatically to handle certain shades of gray.
990 @end defun
992 @defun set-face-font face font &optional frame
993 This function sets the font of face @var{face}.  The argument @var{font}
994 should be a string.
995 @end defun
997 @defun set-face-underline-p face underline-p &optional frame
998 This function sets the underline attribute of face @var{face}.
999 Non-@code{nil} means do underline; @code{nil} means don't.
1000 @end defun
1002 @defun invert-face face &optional frame
1003 Swap the foreground and background colors of face @var{face}.  If the
1004 face doesn't specify both foreground and background, then its foreground
1005 and background are set to the default background and foreground,
1006 respectively.
1007 @end defun
1009   These functions examine the attributes of a face.  If you don't
1010 specify @var{frame}, they refer to the default data for new frames.
1012 @defun face-foreground face &optional frame
1013 @defunx face-background face &optional frame
1014 These functions return the foreground color (or background color,
1015 respectively) of face @var{face}, as a string.
1016 @end defun
1018 @defun face-stipple face &optional frame
1019 This function returns the name of the background stipple pattern of face
1020 @var{face}, or @code{nil} if it doesn't have one.
1021 @end defun
1023 @defun face-font face &optional frame
1024 This function returns the name of the font of face @var{face}.
1025 @end defun
1027 @defun face-underline-p face &optional frame
1028 This function returns the underline attribute of face @var{face}.
1029 @end defun
1031 @defun face-id face
1032 This function returns the face id number of face @var{face}.
1033 @end defun
1035 @defun face-equal face1 face2 &optional frame
1036 This returns @code{t} if the faces @var{face1} and @var{face2} have the
1037 same attributes for display.
1038 @end defun
1040 @defun face-differs-from-default-p face &optional frame
1041 This returns @code{t} if the face @var{face} displays differently from
1042 the default face.  A face is considered to be ``the same'' as the normal
1043 face if each attribute is either the same as that of the default face or
1044 @code{nil} (meaning to inherit from the default).
1045 @end defun
1047 @defvar region-face
1048 This variable's value specifies the face id to use to display characters
1049 in the region when it is active (in Transient Mark mode only).  The face
1050 thus specified takes precedence over all faces that come from text
1051 properties and overlays, for characters in the region.  @xref{The Mark},
1052 for more information about Transient Mark mode.
1054 Normally, the value is the id number of the face named @code{region}.
1055 @end defvar
1057 @node Blinking
1058 @section Blinking Parentheses
1059 @cindex parenthesis matching
1060 @cindex blinking
1061 @cindex balancing parentheses
1062 @cindex close parenthesis
1064   This section describes the mechanism by which Emacs shows a matching
1065 open parenthesis when the user inserts a close parenthesis.
1067 @vindex blink-paren-hook
1068 @defvar blink-paren-function
1069 The value of this variable should be a function (of no arguments) to
1070 be called whenever a character with close parenthesis syntax is inserted.
1071 The value of @code{blink-paren-function} may be @code{nil}, in which
1072 case nothing is done.
1074 @quotation
1075 @strong{Please note:} This variable was named @code{blink-paren-hook} in
1076 older Emacs versions, but since it is not called with the standard
1077 convention for hooks, it was renamed to @code{blink-paren-function} in
1078 version 19.
1079 @end quotation
1080 @end defvar
1082 @defvar blink-matching-paren
1083 If this variable is @code{nil}, then @code{blink-matching-open} does
1084 nothing.
1085 @end defvar
1087 @defvar blink-matching-paren-distance
1088 This variable specifies the maximum distance to scan for a matching
1089 parenthesis before giving up.
1090 @end defvar
1092 @defvar blink-matching-paren-delay
1093 This variable specifies the number of seconds for the cursor to remain
1094 at the matching parenthesis.  A fraction of a second often gives
1095 good results, but the default is 1, which works on all systems.
1096 @end defvar
1098 @defun blink-matching-open
1099 This function is the default value of @code{blink-paren-function}.  It
1100 assumes that point follows a character with close parenthesis syntax and
1101 moves the cursor momentarily to the matching opening character.  If that
1102 character is not already on the screen, it displays the character's
1103 context in the echo area.  To avoid long delays, this function does not
1104 search farther than @code{blink-matching-paren-distance} characters.
1106 Here is an example of calling this function explicitly.
1108 @smallexample
1109 @group
1110 (defun interactive-blink-matching-open ()
1111 @c Do not break this line! -- rms.
1112 @c The first line of a doc string
1113 @c must stand alone.
1114   "Indicate momentarily the start of sexp before point."
1115   (interactive)
1116 @end group
1117 @group
1118   (let ((blink-matching-paren-distance
1119          (buffer-size))
1120         (blink-matching-paren t))
1121     (blink-matching-open)))
1122 @end group
1123 @end smallexample
1124 @end defun
1126 @node Inverse Video
1127 @section Inverse Video
1128 @cindex Inverse Video
1130 @defopt inverse-video
1131 @cindex highlighting
1132 This variable controls whether Emacs uses inverse video for all text
1133 on the screen.  Non-@code{nil} means yes, @code{nil} means no.  The
1134 default is @code{nil}.
1135 @end defopt
1137 @defopt mode-line-inverse-video
1138 This variable controls the use of inverse video for mode lines.  If it
1139 is non-@code{nil}, then mode lines are displayed in inverse video.
1140 Otherwise, mode lines are displayed normally, just like text.  The
1141 default is @code{t}.
1143 For X window frames, this displays mode lines using the face named
1144 @code{modeline}, which is normally the inverse of the default face
1145 unless you change it.
1146 @end defopt
1148 @node Usual Display
1149 @section Usual Display Conventions
1151   The usual display conventions define how to display each character
1152 code.  You can override these conventions by setting up a display table
1153 (@pxref{Display Tables}).  Here are the usual display conventions:
1155 @itemize @bullet
1156 @item
1157 Character codes 32 through 126 map to glyph codes 32 through 126.
1158 Normally this means they display as themselves.
1160 @item
1161 Character code 9 is a horizontal tab.  It displays as whitespace
1162 up to a position determined by @code{tab-width}.
1164 @item
1165 Character code 10 is a newline.
1167 @item
1168 All other codes in the range 0 through 31, and code 127, display in one
1169 of two ways according to the value of @code{ctl-arrow}.  If it is
1170 non-@code{nil}, these codes map to sequences of two glyphs, where the
1171 first glyph is the @sc{ASCII} code for @samp{^}.  (A display table can
1172 specify a glyph to use instead of @samp{^}.)  Otherwise, these codes map
1173 just like the codes in the range 128 to 255.
1175 @item
1176 Character codes 128 through 255 map to sequences of four glyphs, where
1177 the first glyph is the @sc{ASCII} code for @samp{\}, and the others are
1178 digit characters representing the code in octal.  (A display table can
1179 specify a glyph to use instead of @samp{\}.)
1180 @end itemize
1182   The usual display conventions apply even when there is a display
1183 table, for any character whose entry in the active display table is
1184 @code{nil}.  Thus, when you set up a display table, you need only
1185 specify the characters for which you want unusual behavior.
1187   These variables affect the way certain characters are displayed on the
1188 screen.  Since they change the number of columns the characters occupy,
1189 they also affect the indentation functions.
1191 @defopt ctl-arrow
1192 @cindex control characters in display
1193 This buffer-local variable controls how control characters are
1194 displayed.  If it is non-@code{nil}, they are displayed as a caret
1195 followed by the character: @samp{^A}.  If it is @code{nil}, they are
1196 displayed as a backslash followed by three octal digits: @samp{\001}.
1197 @end defopt
1199 @c Following may have overfull hbox.
1200 @defvar default-ctl-arrow
1201 The value of this variable is the default value for @code{ctl-arrow} in
1202 buffers that do not override it.  @xref{Default Value}.
1203 @end defvar
1205 @defopt tab-width
1206 The value of this variable is the spacing between tab stops used for
1207 displaying tab characters in Emacs buffers.  The default is 8.  Note
1208 that this feature is completely independent from the user-settable tab
1209 stops used by the command @code{tab-to-tab-stop}.  @xref{Indent Tabs}.
1210 @end defopt
1212 @node Display Tables
1213 @section Display Tables
1215 @cindex display table
1216 You can use the @dfn{display table} feature to control how all 256
1217 possible character codes display on the screen.  This is useful for
1218 displaying European languages that have letters not in the @sc{ASCII}
1219 character set.
1221 The display table maps each character code into a sequence of
1222 @dfn{glyphs}, each glyph being an image that takes up one character
1223 position on the screen.  You can also define how to display each glyph
1224 on your terminal, using the @dfn{glyph table}.
1226 @menu
1227 * Display Table Format::        What a display table consists of.
1228 * Active Display Table::        How Emacs selects a display table to use.
1229 * Glyphs::                      How to define a glyph, and what glyphs mean.
1230 * ISO Latin 1::                 How to use display tables
1231                                   to support the ISO Latin 1 character set.
1232 @end menu
1234 @node Display Table Format
1235 @subsection Display Table Format
1237   A display table is actually an array of 262 elements.
1239 @defun make-display-table
1240 This creates and returns a display table.  The table initially has
1241 @code{nil} in all elements.
1242 @end defun
1244   The first 256 elements correspond to character codes; the @var{n}th
1245 element says how to display the character code @var{n}.  The value
1246 should be @code{nil} or a vector of glyph values (@pxref{Glyphs}).  If
1247 an element is @code{nil}, it says to display that character according to
1248 the usual display conventions (@pxref{Usual Display}).
1250   If you use the display table to change the display of newline
1251 characters, the whole buffer will be displayed as one long ``line.''
1253   The remaining six elements of a display table serve special purposes,
1254 and @code{nil} means use the default stated below.
1256 @table @asis
1257 @item 256
1258 The glyph for the end of a truncated screen line (the default for this
1259 is @samp{$}).  @xref{Glyphs}.
1260 @item 257
1261 The glyph for the end of a continued line (the default is @samp{\}).
1262 @item 258
1263 The glyph for indicating a character displayed as an octal character
1264 code (the default is @samp{\}).
1265 @item 259
1266 The glyph for indicating a control character (the default is @samp{^}).
1267 @item 260
1268 A vector of glyphs for indicating the presence of invisible lines (the
1269 default is @samp{...}).  @xref{Selective Display}.
1270 @item 261
1271 The glyph used to draw the border between side-by-side windows (the
1272 default is @samp{|}).  @xref{Splitting Windows}.
1273 @end table
1275   For example, here is how to construct a display table that mimics the
1276 effect of setting @code{ctl-arrow} to a non-@code{nil} value:
1278 @example
1279 (setq disptab (make-display-table))
1280 (let ((i 0))
1281   (while (< i 32)
1282     (or (= i ?\t) (= i ?\n)
1283         (aset disptab i (vector ?^ (+ i 64))))
1284     (setq i (1+ i)))
1285   (aset disptab 127 (vector ?^ ??)))
1286 @end example
1288 @node Active Display Table
1289 @subsection Active Display Table
1290 @cindex active display table
1292   Each window can specify a display table, and so can each buffer.  When
1293 a buffer @var{b} is displayed in window @var{w}, display uses the
1294 display table for window @var{w} if it has one; otherwise, the display
1295 table for buffer @var{b} if it has one; otherwise, the standard display
1296 table if any.  The display table chosen is called the @dfn{active}
1297 display table.
1299 @defun window-display-table window
1300 This function returns @var{window}'s display table, or @code{nil}
1301 if @var{window} does not have an assigned display table.
1302 @end defun
1304 @defun set-window-display-table window table
1305 This function sets the display table of @var{window} to @var{table}.
1306 The argument @var{table} should be either a display table or
1307 @code{nil}.
1308 @end defun
1310 @defvar buffer-display-table
1311 This variable is automatically local in all buffers; its value in a
1312 particular buffer is the display table for that buffer, or @code{nil} if
1313 the buffer does not have an assigned display table.
1314 @end defvar
1316 @defvar standard-display-table
1317 This variable's value is the default display table, used whenever a
1318 window has no display table and neither does the buffer displayed in
1319 that window.  This variable is @code{nil} by default.
1320 @end defvar
1322   If there is no display table to use for a particular window---that is,
1323 if the window has none, its buffer has none, and
1324 @code{standard-display-table} has none---then Emacs uses the usual
1325 display conventions for all character codes in that window.  @xref{Usual
1326 Display}.
1328 @node Glyphs
1329 @subsection Glyphs
1331 @cindex glyph
1332   A @dfn{glyph} is a generalization of a character; it stands for an
1333 image that takes up a single character position on the screen.  Glyphs
1334 are represented in Lisp as integers, just as characters are.
1336 @cindex glyph table
1337   The meaning of each integer, as a glyph, is defined by the glyph
1338 table, which is the value of the variable @code{glyph-table}.
1340 @defvar glyph-table
1341 The value of this variable is the current glyph table.  It should be a
1342 vector; the @var{g}th element defines glyph code @var{g}.  If the value
1343 is @code{nil} instead of a vector, then all glyphs are simple (see
1344 below).
1345 @end defvar
1347   Here are the possible types of elements in the glyph table:
1349 @table @var
1350 @item string
1351 Send the characters in @var{string} to the terminal to output
1352 this glyph.  This alternative is available on character terminals,
1353 but not under X.
1355 @item integer
1356 Define this glyph code as an alias for code @var{integer}.  You can use
1357 an alias to specify a face code for the glyph; see below.
1359 @item @code{nil}
1360 This glyph is simple.  On an ordinary terminal, the glyph code mod 256
1361 is the character to output.  With X, the glyph code mod 256 is the
1362 character to output, and the glyph code divided by 256 specifies the
1363 @dfn{face id number} to use while outputting it.  @xref{Faces}.
1364 @end table
1366   If a glyph code is greater than or equal to the length of the glyph
1367 table, that code is automatically simple.
1369 @node ISO Latin 1
1370 @subsection ISO Latin 1
1372 If you have a terminal that can handle the entire ISO Latin 1 character
1373 set, you can arrange to use that character set as follows:
1375 @example
1376 (require 'disp-table)
1377 ;; @r{Set char codes 160--255 to display as themselves.}
1378 ;; @r{(Codes 128--159 are the additional control characters.)}
1379 (standard-display-8bit 160 255)
1380 @end example
1382 If you are editing buffers written in the ISO Latin 1 character set and
1383 your terminal doesn't handle anything but @sc{ASCII}, you can load the
1384 file @file{iso-ascii} to set up a display table that displays the other
1385 ISO characters as explanatory sequences of @sc{ASCII} characters.  For
1386 example, the character ``o with umlaut'' displays as @samp{@{"o@}}.
1388 Some European countries have terminals that don't support ISO Latin 1
1389 but do support the special characters for that country's language.  You
1390 can define a display table to work one language using such terminals.
1391 For an example, see @file{lisp/iso-swed.el}, which handles certain
1392 Swedish terminals.
1394 You can load the appropriate display table for your terminal
1395 automatically by writing a terminal-specific Lisp file for the terminal
1396 type.
1398 @node Beeping
1399 @section Beeping
1400 @cindex beeping
1401 @cindex bell
1403   You can make Emacs ring a bell (or blink the screen) to attract the
1404 user's attention.  Be conservative about how often you do this; frequent
1405 bells can become irritating.  Also be careful not to use beeping alone
1406 when signaling an error is appropriate.  (@xref{Errors}.)
1408 @defun ding &optional dont-terminate
1409 @cindex keyboard macro termination
1410 This function beeps, or flashes the screen (see @code{visible-bell} below).
1411 It also terminates any keyboard macro currently executing unless
1412 @var{dont-terminate} is non-@code{nil}.
1413 @end defun
1415 @defun beep &optional dont-terminate
1416 This is a synonym for @code{ding}.
1417 @end defun
1419 @defvar visible-bell
1420 This variable determines whether Emacs should flash the screen to
1421 represent a bell.  Non-@code{nil} means yes, @code{nil} means no.  This
1422 is effective under X windows, and on a character-only terminal provided
1423 the terminal's Termcap entry defines the visible bell capability
1424 (@samp{vb}).
1425 @end defvar
1427 @node Window Systems
1428 @section Window Systems
1430   Emacs works with several window systems, most notably the X Window
1431 System.  Both Emacs and X use the term ``window'', but use it
1432 differently.  An Emacs frame is a single window as far as X is
1433 concerned; the individual Emacs windows are not known to X at all.
1435 @defvar window-system
1436 @cindex X Window System
1437 This variable tells Lisp programs what window system Emacs is running
1438 under.  Its value should be a symbol such as @code{x} (if Emacs is
1439 running under X) or @code{nil} (if Emacs is running on an ordinary
1440 terminal).
1441 @end defvar
1443 @defvar window-setup-hook
1444 This variable is a normal hook which Emacs runs after loading your
1445 @file{.emacs} file and the default initialization file (if any), after
1446 loading terminal-specific Lisp code, and after running the hook
1447 @code{term-setup-hook}.
1449 This hook is used for internal purposes: setting up communication with
1450 the window system, and creating the initial window.  Users should not
1451 interfere with it.
1452 @end defvar