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