(Auto Faces): Fix typo.
[bpt/emacs.git] / lispref / display.texi
index 8460edc..a537984 100644 (file)
@@ -1,7 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001,
-@c   2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+@c   2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/display
 @node Display, System Interface, Processes, Top
@@ -26,10 +26,10 @@ that Emacs presents to the user.
                           font, colors, etc.
 * Fringes::             Controlling window fringes.
 * Scroll Bars::         Controlling vertical scroll bars.
-* Pointer Shape::       Controlling the mouse pointer shape.
 * Display Property::    Enabling special display features.
 * Images::              Displaying images in Emacs buffers.
 * Buttons::             Adding clickable buttons to Emacs buffers.
+* Abstract Display::    Emacs' Widget for Object Collections.
 * Blinking::            How Emacs shows the matching open parenthesis.
 * Usual Display::       The usual conventions for displaying nonprinting chars.
 * Display Tables::      How to specify other conventions.
@@ -59,8 +59,8 @@ This function clears and redisplays all visible frames.
 redisplay is done, but does not clear them first.
 
 @defun force-window-update &optional object
-This function forces redisplay of some or all windows.  If
-@var{object} is a window, it forces redisplay of that window.  If
+This function forces some or all windows to be updated on next redisplay.
+If @var{object} is a window, it forces redisplay of that window.  If
 @var{object} is a buffer or buffer name, it forces redisplay of all
 windows displaying that buffer.  If @var{object} is @code{nil} (or
 omitted), it forces redisplay of all windows.
@@ -94,45 +94,58 @@ at all if input is available before it starts.  Most of the time, this
 is exactly what you want.  However, you can prevent preemption by
 binding @code{redisplay-dont-pause} to a non-@code{nil} value.
 
-@tindex redisplay-dont-pause
+@defvar redisplay-preemption-period
+This variable specifies how many seconds Emacs waits between checks
+for new input during redisplay.  (The default is 0.1 seconds.)  If
+input has arrived when Emacs checks, it pre-empts redisplay and
+processes the available input before trying again to redisplay.
+
+If this variable is @code{nil}, Emacs does not check for input during
+redisplay, and redisplay cannot be preempted by input.
+
+This variable is only obeyed on graphical terminals.  For
+text terminals, see @ref{Terminal Output}.
+@end defvar
+
 @defvar redisplay-dont-pause
 If this variable is non-@code{nil}, pending input does not
 prevent or halt redisplay; redisplay occurs, and finishes,
 regardless of whether input is available.
 @end defvar
 
-  You can request a display update, but only if no input is pending,
-with @code{(sit-for 0)}.  To force a display update even when input is
-pending, do this:
+@defun redisplay &optional force
+This function performs an immediate redisplay provided there are no
+pending input events.  This is equivalent to @code{(sit-for 0)}.
 
-@example
-(let ((redisplay-dont-pause t))
-  (sit-for 0))
-@end example
+If the optional argument @var{force} is non-@code{nil}, it forces an
+immediate and complete redisplay even if input is available.
+
+Returns @code{t} if redisplay was performed, or @code{nil} otherwise.
+@end defun
 
 @node Truncation
 @section Truncation
 @cindex line wrapping
+@cindex line truncation
 @cindex continuation lines
 @cindex @samp{$} in display
 @cindex @samp{\} in display
 
-  When a line of text extends beyond the right edge of a window, the
-line can either be continued on the next screen line, or truncated to
-one screen line.  The additional screen lines used to display a long
-text line are called @dfn{continuation} lines.  Normally, a @samp{$} in
-the rightmost column of the window indicates truncation; a @samp{\} on
-the rightmost column indicates a line that ``wraps'' onto the next line,
-which is also called @dfn{continuing} the line.  (The display table can
-specify alternative indicators; see @ref{Display Tables}.)
-
-  On a window system display, the @samp{$} and @samp{\} indicators are
-replaced with arrow images displayed in the window fringes
-(@pxref{Fringes}).
-
-  Note that continuation is different from filling; continuation happens
-on the screen only, not in the buffer contents, and it breaks a line
-precisely at the right margin, not at a word boundary.  @xref{Filling}.
+  When a line of text extends beyond the right edge of a window, Emacs
+can @dfn{continue} the line (make it ``wrap'' to the next screen
+line), or @dfn{truncate} the line (limit it to one screen line).  The
+additional screen lines used to display a long text line are called
+@dfn{continuation} lines.  Continuation is not the same as filling;
+continuation happens on the screen only, not in the buffer contents,
+and it breaks a line precisely at the right margin, not at a word
+boundary.  @xref{Filling}.
+
+   On a graphical display, tiny arrow images in the window fringes
+indicate truncated and continued lines (@pxref{Fringes}).  On a text
+terminal, a @samp{$} in the rightmost column of the window indicates
+truncation; a @samp{\} on the rightmost column indicates a line that
+``wraps.''  (The display table can specify alternate characters to use
+for this; @pxref{Display Tables}).
 
 @defopt truncate-lines
 This buffer-local variable controls how Emacs displays lines that extend
@@ -204,13 +217,14 @@ explicitly.
 
 @node Displaying Messages
 @subsection Displaying Messages in the Echo Area
+@cindex display message in echo area
 
   This section describes the functions for explicitly producing echo
 area messages.  Many other Emacs features display messages there, too.
 
-@defun message string &rest arguments
-This function displays a message in the echo area.  The
-argument @var{string} is similar to a C language @code{printf} control
+@defun message format-string &rest arguments
+This function displays a message in the echo area.  The argument
+@var{format-string} is similar to a C language @code{printf} format
 string.  See @code{format} in @ref{Formatting Strings}, for the details
 on the conversion specifications.  @code{message} returns the
 constructed string.
@@ -218,14 +232,15 @@ constructed string.
 In batch mode, @code{message} prints the message text on the standard
 error stream, followed by a newline.
 
-If @var{string}, or strings among the @var{arguments}, have @code{face}
-text properties, these affect the way the message is displayed.
+If @var{format-string}, or strings among the @var{arguments}, have
+@code{face} text properties, these affect the way the message is displayed.
 
 @c Emacs 19 feature
-If @var{string} is @code{nil}, @code{message} clears the echo area; if
-the echo area has been expanded automatically, this brings it back to
-its normal size.  If the minibuffer is active, this brings the
-minibuffer contents back onto the screen immediately.
+If @var{format-string} is @code{nil} or the empty string,
+@code{message} clears the echo area; if the echo area has been
+expanded automatically, this brings it back to its normal size.
+If the minibuffer is active, this brings the minibuffer contents back
+onto the screen immediately.
 
 @example
 @group
@@ -246,7 +261,6 @@ To automatically display a message in the echo area or in a pop-buffer,
 depending on its size, use @code{display-message-or-buffer} (see below).
 @end defun
 
-@tindex with-temp-message
 @defmac with-temp-message message &rest body
 This construct displays a message in the echo area temporarily, during
 the execution of @var{body}.  It displays @var{message}, executes
@@ -254,7 +268,7 @@ the execution of @var{body}.  It displays @var{message}, executes
 the previous echo area contents.
 @end defmac
 
-@defun message-or-box string &rest arguments
+@defun message-or-box format-string &rest arguments
 This function displays a message like @code{message}, but may display it
 in a dialog box instead of the echo area.  If this function is called in
 a command that was invoked using the mouse---more precisely, if
@@ -268,7 +282,8 @@ You can force use of the mouse or of the echo area by binding
 @code{last-nonmenu-event} to a suitable value around the call.
 @end defun
 
-@defun message-box string &rest arguments
+@defun message-box format-string &rest arguments
+@anchor{message-box}
 This function displays a message like @code{message}, but uses a dialog
 box (or a pop-up menu) whenever that is possible.  If it is impossible
 to use a dialog box or pop-up menu, because the terminal does not
@@ -277,7 +292,6 @@ support them, then @code{message-box} uses the echo area, like
 @end defun
 
 @defun display-message-or-buffer message &optional buffer-name not-this-window frame
-@tindex display-message-or-buffer
 This function displays the message @var{message}, which may be either a
 string or a buffer.  If it is shorter than the maximum height of the
 echo area, as defined by @code{max-mini-window-height}, it is displayed
@@ -402,7 +416,7 @@ never print it, there are many good reasons for this not to happen.
 Secondly, ``done'' is more explicit.
 @end defun
 
-@defmac dotimes-with-progress-reporter (var count [result]) message body...
+@defmac dotimes-with-progress-reporter (var count [result]) message body@dots{}
 This is a convenience macro that works the same way as @code{dotimes}
 does, but also reports loop progress using the functions described
 above.  It allows you to save some typing.
@@ -748,10 +762,9 @@ A character is invisible if its @code{invisible} property value
 is @var{atom} or if it is a list with @var{atom} as a member.
 
 @item (@var{atom} . t)
-A character is invisible if its @code{invisible} property value
-is @var{atom} or if it is a list with @var{atom} as a member.
-Moreover, if this character is at the end of a line and is followed
-by a visible newline, it displays an ellipsis.
+A character is invisible if its @code{invisible} property value is
+@var{atom} or if it is a list with @var{atom} as a member.  Moreover,
+a sequence of such characters displays as an ellipsis.
 @end table
 @end table
 @end defvar
@@ -799,15 +812,15 @@ explicitly ignore invisible newlines if
 @code{line-move-ignore-invisible} is non-@code{nil} (the default), but
 only because they are explicitly programmed to do so.
 
-  However, if a command ends with point inside or immediately after
+  However, if a command ends with point inside or immediately before
 invisible text, the main editing loop moves point further forward or
 further backward (in the same direction that the command already moved
 it) until that condition is no longer true.  Thus, if the command
 moved point back into an invisible range, Emacs moves point back to
-the beginning of that range, following the previous visible character.
-If the command moved point forward into an invisible range, Emacs
-moves point forward past the first visible character that follows the
-invisible text.
+the beginning of that range, and then back one more character.  If the
+command moved point forward into an invisible range, Emacs moves point
+forward up to the first visible character that follows the invisible
+text.
 
   Incremental search can make invisible overlays visible temporarily
 and/or permanently when a match includes invisible text.  To enable
@@ -827,7 +840,7 @@ make it invisible again.
 
 @node Selective Display
 @section Selective Display
-@cindex selective display
+@c @cindex selective display   Duplicates selective-display
 
   @dfn{Selective display} refers to a pair of related features for
 hiding certain lines on the screen.
@@ -1016,7 +1029,6 @@ selected.
 @end defvar
 
 @defvar temp-buffer-setup-hook
-@tindex temp-buffer-setup-hook
 This normal hook is run by @code{with-output-to-temp-buffer} before
 evaluating @var{body}.  When the hook runs, the temporary buffer is
 current.  This hook is normally set up with a function to put the
@@ -1098,7 +1110,7 @@ object that belongs to a particular buffer, and has a specified
 beginning and end.  It also has properties that you can examine and set;
 these affect the display of the text within the overlay.
 
-An overlays uses markers to record its beginning and end; thus,
+An overlay uses markers to record its beginning and end; thus,
 editing the text of the buffer adjusts the beginning and end of each
 overlay so that it stays with the text.  When you create the overlay,
 you can specify whether text inserted at the beginning should be
@@ -1180,7 +1192,7 @@ The return value is @var{overlay}.
 This is the only valid way to change the endpoints of an overlay.  Do
 not try modifying the markers in the overlay by hand, as that fails to
 update other vital data structures and can cause some overlays to be
-``lost''.
+``lost.''
 @end defun
 
 @defun remove-overlays &optional start end name value
@@ -1248,6 +1260,21 @@ foo
      @result{} t
 @end example
 
+  Emacs stores the overlays of each buffer in two lists, divided
+around an arbitrary ``center position.''  One list extends backwards
+through the buffer from that center position, and the other extends
+forwards from that center position.  The center position can be anywhere
+in the buffer.
+
+@defun overlay-recenter pos
+This function recenters the overlays of the current buffer around
+position @var{pos}.  That makes overlay lookup faster for positions
+near @var{pos}, but slower for positions far away from @var{pos}.
+@end defun
+
+  A loop that scans the buffer forwards, creating overlays, can run
+faster if you do @code{(overlay-recenter (point-max))} first.
+
 @node Overlay Properties
 @subsection Overlay Properties
 
@@ -1338,7 +1365,7 @@ specify a particular attribute for certain text.  @xref{Face
 Attributes}.
 
 @item
-A cons cell of the form @code{(foreground-color . @var{color-name})} or
+A cons cell, either of the form @code{(foreground-color . @var{color-name})} or
 @code{(background-color . @var{color-name})}.  These elements specify
 just the foreground color or just the background color.
 
@@ -1391,6 +1418,9 @@ If these functions modify the buffer, they should bind
 @code{inhibit-modification-hooks} to @code{t} around doing so, to
 avoid confusing the internal mechanism that calls these hooks.
 
+Text properties also support the @code{modification-hooks} property,
+but the details are somewhat different (@pxref{Special Properties}).
+
 @item insert-in-front-hooks
 @kindex insert-in-front-hooks @r{(overlay property)}
 This property's value is a list of functions to be called before and
@@ -1501,17 +1531,22 @@ end of an overlay, before @var{pos}.  If there is none, it returns
 @code{(point-min)}.
 @end defun
 
-  Here's an easy way to use @code{next-overlay-change} to search for the
-next character which gets a non-@code{nil} @code{happy} property from
-either its overlays or its text properties (@pxref{Property Search}):
+  As an example, here's a simplified (and inefficient) version of the
+primitive function @code{next-single-char-property-change}
+(@pxref{Property Search}).  It searches forward from position
+@var{pos} for the next position where the value of a given property
+@code{prop}, as obtained from either overlays or text properties,
+changes.
 
 @smallexample
-(defun find-overlay-prop (prop)
+(defun next-single-char-property-change (position prop)
   (save-excursion
-    (while (and (not (eobp))
-                (not (get-char-property (point) 'happy)))
-      (goto-char (min (next-overlay-change (point))
-                      (next-single-property-change (point) 'happy))))
+    (goto-char position)
+    (let ((propval (get-char-property (point) prop)))
+      (while (and (not (eobp))
+                  (eq (get-char-property (point) prop) propval))
+        (goto-char (min (next-overlay-change (point))
+                        (next-single-property-change (point) prop)))))
     (point)))
 @end smallexample
 
@@ -1575,41 +1610,41 @@ equal to or less than the display width of @var{ellipsis}.  If
 @cindex line height
 
   The total height of each display line consists of the height of the
-contents of the line, and additional vertical line spacing below the
-display row.
+contents of the line, plus optional additional vertical line spacing
+above or below the display line.
 
-  The height of the line contents is normally determined from the
-maximum height of any character or image on that display line,
-including the final newline if there is one.  (A line that is
-continued doesn't include a final newline.)  In the most common case,
-the line height equals the height of the default frame font.
+  The height of the line contents is the maximum height of any
+character or image on that display line, including the final newline
+if there is one.  (A display line that is continued doesn't include a
+final newline.)  That is the default line height, if you do nothing to
+specify a greater height.  (In the most common case, this equals the
+height of the default frame font.)
 
-  There are several ways to explicitly control or change the line
-height, either by specifying an absolute height for the display line,
-or by adding additional vertical space below one or all lines.
+  There are several ways to explicitly specify a larger line height,
+either by specifying an absolute height for the display line, or by
+specifying vertical space.  However, no matter what you specify, the
+actual line height can never be less than the default.
 
 @kindex line-height @r{(text property)}
   A newline can have a @code{line-height} text or overlay property
 that controls the total height of the display line ending in that
 newline.
 
-  If the property value is a list @code{(@var{height} @var{total})},
-then @var{height} is used as the actual property value for the
-@code{line-height}, and @var{total} specifies the total displayed
-height of the line, so the line spacing added below the line equals
-the @var{total} height minus the actual line height.  In this case,
-the other ways to specify the line spacing are ignored.
+  If the property value is @code{t}, the newline character has no
+effect on the displayed height of the line---the visible contents
+alone determine the height.  This is useful for tiling small images
+(or image slices) without adding blank areas between the images.
 
-  If the property value is @code{t}, the displayed height of the
-line is exactly what its contents demand; no line-spacing is added.
-This case is useful for tiling small images or image slices without
-adding blank areas between the images.
+  If the property value is a list of the form @code{(@var{height}
+@var{total})}, that adds extra space @emph{below} the display line.
+First Emacs uses @var{height} as a height spec to control extra space
+@emph{above} the line; then it adds enough space @emph{below} the line
+to bring the total line height up to @var{total}.  In this case, the
+other ways to specify the line spacing are ignored.
 
-  If the property value is not @code{t}, it is a height spec.  A height
-spec stands for a numeric height value; this height spec specifies the
-actual line height, @var{line-height}.  There are several ways to
-write a height spec; here's how each of them translates into a numeric
-height:
+  Any other kind of property value is a height spec, which translates
+into a number---the specified line height.  There are several ways to
+write a height spec; here's how each of them translates into a number:
 
 @table @code
 @item @var{integer}
@@ -1627,11 +1662,10 @@ If the height spec is a cons of the format shown, the numeric height
 is @var{ratio} times the height of the contents of the line.
 @end table
 
-  Thus, any valid non-@code{t} property value specifies a height in pixels,
-@var{line-height}, one way or another.  If the line contents' height
-is less than @var{line-height}, Emacs adds extra vertical space above
-the line to achieve the total height @var{line-height}.  Otherwise,
-@var{line-height} has no effect.
+  Thus, any valid height spec determines the height in pixels, one way
+or another.  If the line contents' height is less than that, Emacs
+adds extra vertical space above the line to achieve the specified
+total height.
 
   If you don't specify the @code{line-height} property, the line's
 height consists of the contents' height plus the line spacing.
@@ -1644,21 +1678,21 @@ parts of Emacs text.
 However, if the variable @code{default-line-spacing} is
 non-@code{nil}, it overrides the frame's @code{line-spacing}
 parameter.  An integer value specifies the number of pixels put below
-lines on window systems.  A floating point number specifies the
+lines on graphical displays.  A floating point number specifies the
 spacing relative to the frame's default line height.
 
 @vindex line-spacing
   You can specify the line spacing for all lines in a buffer via the
 buffer-local @code{line-spacing} variable.  An integer value specifies
-the number of pixels put below lines on window systems.  A floating
+the number of pixels put below lines on graphical displays.  A floating
 point number specifies the spacing relative to the default frame line
 height.  This overrides line spacings specified for the frame.
 
 @kindex line-spacing @r{(text property)}
   Finally, a newline can have a @code{line-spacing} text or overlay
-property that controls the height of the display line ending with that
-newline.  The property value overrides the default frame line spacing
-and the buffer local @code{line-spacing} variable.
+property that overrides the default frame line spacing and the buffer
+local @code{line-spacing} variable, for the display line ending in
+that newline.
 
   One way or another, these mechanisms specify a Lisp value for the
 spacing of each line.  The value is a height spec, and it translates
@@ -1673,7 +1707,9 @@ height.
   A @dfn{face} is a named collection of graphical attributes: font
 family, foreground color, background color, optional underlining, and
 many others.  Faces are used in Emacs to control the style of display of
-particular parts of the text or the frame.
+particular parts of the text or the frame.  @xref{Standard Faces,,,
+emacs, The GNU Emacs Manual}, for the list of faces Emacs normally
+comes with.
 
 @cindex face id
 Each face has its own @dfn{face number}, which distinguishes faces at
@@ -1691,7 +1727,6 @@ same meaning in all frames.  But you can arrange to give a particular
 face name a special meaning in one frame if you wish.
 
 @menu
-* Standard Faces::      The faces Emacs normally comes with.
 * Defining Faces::      How to define a face with @code{defface}.
 * Face Attributes::     What is in a face?
 * Attribute Functions::  Functions to examine and set face attributes.
@@ -1705,139 +1740,6 @@ face name a special meaning in one frame if you wish.
                           that handle a range of character sets.
 @end menu
 
-@node Standard Faces
-@subsection Standard Faces
-
-  This table lists all the standard faces and their uses.  Most of them
-are used for displaying certain parts of the frames or certain kinds of
-text; you can control how those places look by customizing these faces.
-
-@table @code
-@item default
-@kindex default @r{(face name)}
-This face is used for ordinary text.
-
-@item mode-line
-@kindex mode-line @r{(face name)}
-This face is used for the mode line of the selected window, and for
-menu bars when toolkit menus are not used.
-
-@item modeline
-@kindex modeline @r{(face name)}
-This is an alias for the @code{mode-line} face, for compatibility with
-old Emacs versions.
-
-@item mode-line-inactive
-@kindex mode-line-inactive @r{(face name)}
-This face is used for mode lines of non-selected windows.
-This face inherits from @code{mode-line}, so changes
-in that face affect all windows.
-
-@item header-line
-@kindex header-line @r{(face name)}
-This face is used for the header lines of windows that have them.
-
-@item menu
-This face controls the display of menus, both their colors and their
-font.  (This works only on certain systems.)
-
-@item fringe
-@kindex fringe @r{(face name)}
-This face controls the default colors of window fringes, the thin
-areas on either side that are used to display continuation and
-truncation glyphs.  Other faces used to display bitmaps in the fringe
-are implicitly merged with this face.
-
-@item minibuffer-prompt
-@kindex minibuffer-prompt @r{(face name)}
-@vindex minibuffer-prompt-properties
-This face is used for the text of minibuffer prompts.  By default,
-Emacs automatically adds this face to the value of
-@code{minibuffer-prompt-properties}, which is a list of text
-properties used to display the prompt text.
-
-@item scroll-bar
-@kindex scroll-bar @r{(face name)}
-This face controls the colors for display of scroll bars.
-
-@item tool-bar
-@kindex tool-bar @r{(face name)}
-This face is used for display of the tool bar, if any.
-
-@item region
-@kindex region @r{(face name)}
-This face is used for highlighting the region in Transient Mark mode.
-
-@item secondary-selection
-@kindex secondary-selection @r{(face name)}
-This face is used to show any secondary selection you have made.
-
-@item highlight
-@kindex highlight @r{(face name)}
-This face is meant to be used for highlighting for various purposes.
-
-@item mode-line-highlight
-@kindex mode-line-highlight @r{(face name)}
-This face is used for highlighting something on @code{mode-line} or
-@code{header-line} for various purposes.
-
-@item trailing-whitespace
-@kindex trailing-whitespace @r{(face name)}
-This face is used to display excess whitespace at the end of a line,
-if @code{show-trailing-whitespace} is non-@code{nil}.
-
-@item escape-glyph
-@kindex escape-glyph @r{(face name)}
-This face is used to display control characters and escape glyphs.
-@end table
-
-  In contrast, these faces are provided to change the appearance of text
-in specific ways.  You can use them on specific text, when you want
-the effects they produce.
-
-@table @code
-@item bold
-@kindex bold @r{(face name)}
-This face uses a bold font, if possible.  It uses the bold variant of
-the frame's font, if it has one.  It's up to you to choose a default
-font that has a bold variant, if you want to use one.
-
-@item italic
-@kindex italic @r{(face name)}
-This face uses the italic variant of the frame's font, if it has one.
-
-@item bold-italic
-@kindex bold-italic @r{(face name)}
-This face uses the bold italic variant of the frame's font, if it has
-one.
-
-@item underline
-@kindex underline @r{(face name)}
-This face underlines text.
-
-@item fixed-pitch
-@kindex fixed-pitch @r{(face name)}
-This face forces use of a particular fixed-width font.
-
-@item variable-pitch
-@kindex variable-pitch @r{(face name)}
-This face forces use of a particular variable-width font.  It's
-reasonable to customize this to use a different variable-width font, if
-you like, but you should not make it a fixed-width font.
-
-@item shadow
-@kindex shadow @r{(face name)}
-This face is used for making the text less noticeable than the
-surrounding ordinary text.
-@end table
-
-@defvar show-trailing-whitespace
-@tindex show-trailing-whitespace
-If this variable is non-@code{nil}, Emacs uses the
-@code{trailing-whitespace} face to display any spaces and tabs at the
-end of a line.
-@end defvar
-
 @node Defining Faces
 @subsection Defining Faces
 
@@ -1846,7 +1748,7 @@ kind of customization item (@pxref{Customization}) which the user can
 customize using the Customization buffer (@pxref{Easy Customization,,,
 emacs, The GNU Emacs Manual}).
 
-@defmac defface face spec doc [keyword value]...
+@defmac defface face spec doc [keyword value]@dots{}
 This declares @var{face} as a customizable face that defaults
 according to @var{spec}.  You should not quote the symbol @var{face},
 and it should not end in @samp{-face} (that would be redundant).  The
@@ -1858,11 +1760,16 @@ When @code{defface} executes, it defines the face according to
 @var{spec}, then uses any customizations that were read from the
 init file (@pxref{Init File}) to override that specification.
 
+When you evaluate a @code{defface} form with @kbd{C-M-x} in Emacs
+Lisp mode (@code{eval-defun}), a special feature of @code{eval-defun}
+overrides any customizations of the face.  This way, the face reflects
+exactly what the @code{defface} says.
+
 The purpose of @var{spec} is to specify how the face should appear on
 different kinds of terminals.  It should be an alist whose elements
 have the form @code{(@var{display} @var{atts})}.  Each element's
 @sc{car}, @var{display}, specifies a class of terminals.  (The first
-element, if it s @sc{car} is @code{default}, is special---it specifies
+element, if its @sc{car} is @code{default}, is special---it specifies
 defaults for the remaining elements).  The element's @sc{cadr},
 @var{atts}, is a list of face attributes and their values; it
 specifies what the face should look like on that kind of terminal.
@@ -1897,8 +1804,9 @@ apply to.  Here are the possible values of @var{characteristic}:
 @item type
 The kind of window system the frame uses---either @code{graphic} (any
 graphics-capable display), @code{x}, @code{pc} (for the MS-DOS console),
-@code{w32} (for MS Windows 9X/NT), or @code{tty} (a non-graphics-capable
-display).
+@code{w32} (for MS Windows 9X/NT/2K/XP), @code{mac} (for the Macintosh
+display), or @code{tty} (a non-graphics-capable display).
+@xref{Window Systems, window-system}.
 
 @item class
 What kinds of colors the frame supports---either @code{color},
@@ -1933,6 +1841,7 @@ frame must match one of the @var{value}s specified for it in
 
 @example
 @group
+(defface region
   '((((class color) (min-colors 88) (background dark))
      :background "blue3")
 @end group
@@ -1974,9 +1883,9 @@ as if they had a light background.
 
   The effect of using a face is determined by a fixed set of @dfn{face
 attributes}.  This table lists all the face attributes, and what they
-mean.  Note that in general, more than one face can be specified for a
-given piece of text; when that happens, the attributes of all the faces
-are merged to specify how to display the text.  @xref{Displaying Faces}.
+mean.  You can specify more than one face for a given piece of text;
+Emacs merges the attributes of all the faces to determine how to
+display the text.  @xref{Displaying Faces}.
 
   Any attribute in a face can have the value @code{unspecified}.  This
 means the face doesn't specify that attribute.  In face merging, when
@@ -2130,7 +2039,7 @@ A non-@code{nil} value specifies a bold font.
 A non-@code{nil} value specifies an italic font.
 @end table
 
-  For compatibility, you can still set these ``attributes'', even
+  For compatibility, you can still set these ``attributes,'' even
 though they are not real face attributes.  Here is what that does:
 
 @table @code
@@ -2165,16 +2074,13 @@ suitable for use with @code{:stipple} (see above).  It returns
 @node Attribute Functions
 @subsection Face Attribute Functions
 
-  You can modify the attributes of an existing face with the following
-functions.  If you specify @var{frame}, they affect just that frame;
-otherwise, they affect all frames as well as the defaults that apply to
-new frames.
+  This section describes the functions for accessing and modifying the
+attributes of an existing face.
 
-@tindex set-face-attribute
 @defun set-face-attribute face frame &rest arguments
-This function sets one or more attributes of face @var{face}
-for frame @var{frame}.  If @var{frame} is @code{nil}, it sets
-the attribute for all frames, and the defaults for new frames.
+This function sets one or more attributes of face @var{face} for frame
+@var{frame}.  The attributes you specify this way override whatever
+the @code{defface} says.
 
 The extra arguments @var{arguments} specify the attributes to set, and
 the values for them.  They should consist of alternating attribute names
@@ -2191,16 +2097,24 @@ Thus,
 @noindent
 sets the attributes @code{:width}, @code{:weight} and @code{:underline}
 to the corresponding values.
+
+If @var{frame} is @code{t}, this function sets the default attributes
+for new frames.  Default attribute values specified this way override
+the @code{defface} for newly created frames.
+
+If @var{frame} is @code{nil}, this function sets the attributes for
+all existing frames, and the default for new frames.
 @end defun
 
-@tindex face-attribute
 @defun face-attribute face attribute &optional frame inherit
 This returns the value of the @var{attribute} attribute of face
 @var{face} on @var{frame}.  If @var{frame} is @code{nil},
 that means the selected frame (@pxref{Input Focus}).
 
-If @var{frame} is @code{t}, the value is the default for
-@var{face} for new frames.
+If @var{frame} is @code{t}, this returns whatever new-frames default
+value you previously specified with @code{set-face-attribute} for the
+@var{attribute} attribute of @var{face}.  If you have not specified
+one, it returns @code{nil}.
 
 If @var{inherit} is @code{nil}, only attributes directly defined by
 @var{face} are considered, so the return value may be
@@ -2225,18 +2139,24 @@ For example,
 @end example
 @end defun
 
-  The functions above did not exist before Emacs 21.  For compatibility
-with older Emacs versions, you can use the following functions to set
-and examine the face attributes which existed in those versions.
-
-@tindex face-attribute-relative-p
 @defun face-attribute-relative-p attribute value
-This function returns non-@code{nil} if @var{value}, when used as
-the value of the face attribute @var{attribute}, is relative (that is,
-if it modifies an underlying or inherited value of @var{attribute}).
+This function returns non-@code{nil} if @var{value}, when used as the
+value of the face attribute @var{attribute}, is relative.  This means
+it would modify, rather than completely override, any value that comes
+from a subsequent face in the face list or that is inherited from
+another face.
+
+@code{unspecified} is a relative value for all attributes.
+For @code{:height}, floating point values are also relative.
+
+For example:
+
+@example
+(face-attribute-relative-p :height 2.0)
+     @result{} t
+@end example
 @end defun
 
-@tindex merge-face-attribute
 @defun merge-face-attribute attribute value1 value2
 If @var{value1} is a relative value for the face attribute
 @var{attribute}, returns it merged with the underlying value
@@ -2244,6 +2164,12 @@ If @var{value1} is a relative value for the face attribute
 face attribute @var{attribute}, returns @var{value1} unchanged.
 @end defun
 
+  The functions above did not exist before Emacs 21.  For compatibility
+with older Emacs versions, you can use the following functions to set
+and examine the face attributes which existed in those versions.
+They use values of @code{t} and @code{nil} for @var{frame}
+just like @code{set-face-attribute} and @code{face-attribute}.
+
 @defun set-face-foreground face color &optional frame
 @defunx set-face-background face color &optional frame
 These functions set the foreground (or background, respectively) color
@@ -2283,24 +2209,30 @@ This function specifies whether @var{face} should be italic.  If
 This actually sets the @code{:slant} attribute.
 @end defun
 
-@defun set-face-underline-p face underline-p &optional frame
+@defun set-face-underline-p face underline &optional frame
 This function sets the underline attribute of face @var{face}.
 Non-@code{nil} means do underline; @code{nil} means don't.
+If @var{underline} is a string, underline with that color.
+@end defun
+
+@defun set-face-inverse-video-p face inverse-video-p &optional frame
+This function sets the @code{:inverse-video} attribute of face
+@var{face}.
 @end defun
 
 @defun invert-face face &optional frame
-This function inverts the @code{:inverse-video} attribute of face
-@var{face}.  If the attribute is @code{nil}, this function sets it to
-@code{t}, and vice versa.
+This function swaps the foreground and background colors of face
+@var{face}.
 @end defun
 
   These functions examine the attributes of a face.  If you don't
-specify @var{frame}, they refer to the default data for new frames.
-They return the symbol @code{unspecified} if the face doesn't define any
-value for that attribute.
+specify @var{frame}, they refer to the selected frame; @code{t} refers
+to the default data for new frames.  They return the symbol
+@code{unspecified} if the face doesn't define any value for that
+attribute.
 
 @defun face-foreground face &optional frame inherit
-@defunx face-background face &optional frame
+@defunx face-background face &optional frame inherit
 These functions return the foreground color (or background color,
 respectively) of face @var{face}, as a string.
 
@@ -2378,7 +2310,8 @@ properties too; they apply to all the text covered by the overlay.
 
 @item
 With a region that is active.  In Transient Mark mode, the region is
-highlighted with the face @code{region} (@pxref{Standard Faces}).
+highlighted with the face @code{region} (@pxref{Standard Faces,,,
+emacs, The GNU Emacs Manual}).
 
 @item
 With special glyphs.  Each glyph can specify a particular face
@@ -2420,7 +2353,6 @@ not available, you can specify a set of mappings for alternatives to
 try.
 
 @defvar face-font-selection-order
-@tindex face-font-selection-order
 This variable specifies the order of importance of the face attributes
 @code{:width}, @code{:height}, @code{:weight}, and @code{:slant}.  The
 value should be a list containing those four symbols, in order of
@@ -2450,7 +2382,6 @@ quite right.
 @end defvar
 
 @defvar face-font-family-alternatives
-@tindex face-font-family-alternatives
 This variable lets you specify alternative font families to try, if a
 given family is specified and doesn't exist.  Each element should have
 this form:
@@ -2465,7 +2396,6 @@ family that does exist.
 @end defvar
 
 @defvar face-font-registry-alternatives
-@tindex face-font-registry-alternatives
 This variable lets you specify alternative font registries to try, if a
 given registry is specified and doesn't exist.  Each element should have
 this form:
@@ -2484,7 +2414,6 @@ them, since the use of too many or too big scalable fonts can crash
 XFree86 servers.
 
 @defvar scalable-fonts-allowed
-@tindex scalable-fonts-allowed
 This variable controls which scalable fonts to use.  A value of
 @code{nil}, the default, means do not use scalable fonts.  @code{t}
 means to use any scalable font that seems appropriate for the text.
@@ -2501,13 +2430,6 @@ expression in the list.  For example,
 allows the use of scalable fonts with registry @code{muleindian-2}.
 @end defvar
 
-@defun clear-face-cache &optional unload-p
-@tindex clear-face-cache
-This function clears the face cache for all frames.
-If @var{unload-p} is non-@code{nil}, that means to unload
-all unused fonts as well.
-@end defun
-
 @defvar face-font-rescale-alist
 This variable specifies scaling for certain faces.  Its value should
 be a list of elements of the form
@@ -2588,11 +2510,10 @@ makes @code{modeline} an alias for the @code{mode-line} face.
 @cindex automatic face assignment
 @cindex faces, automatic choice
 
-@cindex Font-Lock mode
   This hook is used for automatically assigning faces to text in the
-buffer.  It is part of the implementation of Font-Lock mode.
+buffer.  It is part of the implementation of Jit-Lock mode, used by
+Font-Lock.
 
-@tindex fontification-functions
 @defvar fontification-functions
 This variable holds a list of functions that are called by Emacs
 redisplay as needed to assign faces automatically to text in the buffer.
@@ -2642,7 +2563,6 @@ many fonts match the pattern.
 @end defun
 
 @defun x-family-fonts &optional family frame
-@tindex x-family-fonts
 This function returns a list describing the available fonts for family
 @var{family} on @var{frame}.  If @var{family} is omitted or @code{nil},
 this list applies to all families, and therefore, it contains all
@@ -2673,7 +2593,6 @@ The result list is sorted according to the current face font sort order.
 @end defun
 
 @defun x-font-family-list &optional frame
-@tindex x-font-family-list
 This function returns a list of the font families available for
 @var{frame}'s display.  If @var{frame} is omitted or @code{nil}, it
 describes the selected frame's display (@pxref{Input Focus}).
@@ -2690,7 +2609,6 @@ non-@code{nil} if fonts of that family are fixed-pitch.
 @end defun
 
 @defvar font-list-limit
-@tindex font-list-limit
 This variable specifies maximum number of fonts to consider in font
 matching.  The function @code{x-family-fonts} will not return more than
 that many fonts, and font selection will consider only that many fonts
@@ -2834,7 +2752,7 @@ does that, this function's value may not be accurate.
 
 @node Fringes
 @section Fringes
-@cindex Fringes
+@cindex fringes
 
   The @dfn{fringes} of a window are thin vertical strips down the
 sides that are used for displaying bitmaps that indicate truncation,
@@ -2842,7 +2760,9 @@ continuation, horizontal scrolling, and the overlay arrow.
 
 @menu
 * Fringe Size/Pos::     Specifying where to put the window fringes.
-* Fringe Bitmaps::      Displaying bitmaps in the window fringes.
+* Fringe Indicators::   Displaying indicator icons in the window fringes.
+* Fringe Cursors::      Displaying cursors in the right fringe.
+* Fringe Bitmaps::      Specifying bitmaps for fringe indicators.
 * Customizing Bitmaps:: Specifying your own bitmaps to use in the fringes.
 * Overlay Arrow::       Display of an arrow to indicate position.
 @end menu
@@ -2850,23 +2770,25 @@ continuation, horizontal scrolling, and the overlay arrow.
 @node Fringe Size/Pos
 @subsection Fringe Size and Position
 
-  Here's how to control the position and width of the window fringes.
+  The following buffer-local variables control the position and width
+of the window fringes.
 
 @defvar fringes-outside-margins
-If the value is non-@code{nil}, the frames appear outside the display
-margins.  The fringes normally appear between the display margins and
-the window text.  It works to set @code{fringes-outside-margins}
-buffer-locally.  @xref{Display Margins}.
+The fringes normally appear between the display margins and the window
+text.  If the value is non-@code{nil}, they appear outside the display
+margins.  @xref{Display Margins}.
 @end defvar
 
 @defvar left-fringe-width
 This variable, if non-@code{nil}, specifies the width of the left
-fringe in pixels.
+fringe in pixels.  A value of @code{nil} means to use the left fringe
+width from the window's frame.
 @end defvar
 
 @defvar right-fringe-width
 This variable, if non-@code{nil}, specifies the width of the right
-fringe in pixels.
+fringe in pixels.  A value of @code{nil} means to use the right fringe
+width from the window's frame.
 @end defvar
 
   The values of these variables take effect when you display the
@@ -2892,6 +2814,155 @@ window is used.  The value has the form @code{(@var{left-width}
 @var{right-width} @var{outside-margins})}.
 @end defun
 
+
+@node Fringe Indicators
+@subsection Fringe Indicators
+@cindex fringe indicators
+@cindex indicators, fringe
+
+  The @dfn{fringe indicators} are tiny icons Emacs displays in the
+window fringe (on a graphic display) to indicate truncated or
+continued lines, buffer boundaries, overlay arrow, etc.
+
+@defopt indicate-empty-lines
+@cindex fringes, and empty line indication
+When this is non-@code{nil}, Emacs displays a special glyph in the
+fringe of each empty line at the end of the buffer, on graphical
+displays.  @xref{Fringes}.  This variable is automatically
+buffer-local in every buffer.
+@end defopt
+
+@defvar indicate-buffer-boundaries
+This buffer-local variable controls how the buffer boundaries and
+window scrolling are indicated in the window fringes.
+
+Emacs can indicate the buffer boundaries---that is, the first and last
+line in the buffer---with angle icons when they appear on the screen.
+In addition, Emacs can display an up-arrow in the fringe to show
+that there is text above the screen, and a down-arrow to show
+there is text below the screen.
+
+There are three kinds of basic values:
+
+@table @asis
+@item @code{nil}
+Don't display any of these fringe icons.
+@item @code{left}
+Display the angle icons and arrows in the left fringe.
+@item @code{right}
+Display the angle icons and arrows in the right fringe.
+@item any non-alist
+Display the angle icons in the left fringe
+and don't display the arrows.
+@end table
+
+Otherwise the value should be an alist that specifies which fringe
+indicators to display and where.  Each element of the alist should
+have the form @code{(@var{indicator} . @var{position})}.  Here,
+@var{indicator} is one of @code{top}, @code{bottom}, @code{up},
+@code{down}, and @code{t} (which covers all the icons not yet
+specified), while @var{position} is one of @code{left}, @code{right}
+and @code{nil}.
+
+For example, @code{((top . left) (t . right))} places the top angle
+bitmap in left fringe, and the bottom angle bitmap as well as both
+arrow bitmaps in right fringe.  To show the angle bitmaps in the left
+fringe, and no arrow bitmaps, use @code{((top .  left) (bottom . left))}.
+@end defvar
+
+@defvar default-indicate-buffer-boundaries
+The value of this variable is the default value for
+@code{indicate-buffer-boundaries} in buffers that do not override it.
+@end defvar
+
+@defvar fringe-indicator-alist
+This buffer-local variable specifies the mapping from logical fringe
+indicators to the actual bitmaps displayed in the window fringes.
+
+These symbols identify the logical fringe indicators:
+
+@table @asis
+@item Truncation and continuation line indicators:
+@code{truncation}, @code{continuation}.
+
+@item Buffer position indicators:
+@code{up}, @code{down},
+@code{top}, @code{bottom},
+@code{top-bottom}.
+
+@item Empty line indicator:
+@code{empty-line}.
+
+@item Overlay arrow indicator:
+@code{overlay-arrow}.
+
+@item Unknown bitmap indicator:
+@code{unknown}.
+@end table
+
+  The value is an alist where each element @code{(@var{indicator} . @var{bitmaps})}
+specifies the fringe bitmaps used to display a specific logical
+fringe indicator.
+
+Here, @var{indicator} specifies the logical indicator type, and
+@var{bitmaps} is list of symbols @code{(@var{left} @var{right}
+[@var{left1} @var{right1}])} which specifies the actual bitmap shown
+in the left or right fringe for the logical indicator.
+
+The @var{left} and @var{right} symbols specify the bitmaps shown in
+the left and/or right fringe for the specific indicator.  The
+@var{left1} or @var{right1} bitmaps are used only for the `bottom' and
+`top-bottom indicators when the last (only) line in has no final
+newline.  Alternatively, @var{bitmaps} may be a single symbol which is
+used in both left and right fringes.
+
+When @code{fringe-indicator-alist} has a buffer-local value, and there
+is no bitmap defined for a logical indicator, or the bitmap is
+@code{t}, the corresponding value from the (non-local)
+@code{default-fringe-indicator-alist} is used.
+
+To completely hide a specific indicator, set the bitmap to @code{nil}.
+@end defvar
+
+@defvar default-fringe-indicator-alist
+The value of this variable is the default value for
+@code{fringe-indicator-alist} in buffers that do not override it.
+@end defvar
+
+Standard fringe bitmaps for indicators:
+@example
+left-arrow right-arrow up-arrow down-arrow
+left-curly-arrow right-curly-arrow
+left-triangle right-triangle
+top-left-angle top-right-angle
+bottom-left-angle bottom-right-angle
+left-bracket right-bracket
+filled-rectangle hollow-rectangle
+filled-square hollow-square
+vertical-bar horizontal-bar
+empty-line question-mark
+@end example
+
+@node Fringe Cursors
+@subsection Fringe Cursors
+@cindex fringe cursors
+@cindex cursor, fringe
+
+  When a line is exactly as wide as the window, Emacs displays the
+cursor in the right fringe instead of using two lines.  Different
+bitmaps are used to represent the cursor in the fringe depending on
+the current buffer's cursor type.
+
+@table @asis
+@item Logical cursor types:
+@code{box} , @code{hollow}, @code{bar},
+@code{hbar}, @code{hollow-small}.
+@end table
+
+The @code{hollow-small} type is used instead of @code{hollow} when the
+normal @code{hollow-rectangle} bitmap is too tall to fit on a specific
+display line.
+
 @defvar overflow-newline-into-fringe
 If this is non-@code{nil}, lines exactly as wide as the window (not
 counting the final newline character) are not continued.  Instead,
@@ -2899,16 +2970,43 @@ when point is at the end of the line, the cursor appears in the right
 fringe.
 @end defvar
 
+@defvar fringe-cursor-alist
+This variable specifies the mapping from logical cursor type to the
+actual fringe bitmaps displayed in the right fringe.  The value is an
+alist where each element @code{(@var{cursor} . @var{bitmap})} specifies
+the fringe bitmaps used to display a specific logical cursor type in
+the fringe.  Here, @var{cursor} specifies the logical cursor type and
+@var{bitmap} is a symbol specifying the fringe bitmap to be displayed
+for that logical cursor type.
+
+When @code{fringe-cursor-alist} has a buffer-local value, and there is
+no bitmap defined for a cursor type, the corresponding value from the
+(non-local) @code{default-fringes-indicator-alist} is used.
+@end defvar
+
+@defvar default-fringes-cursor-alist
+The value of this variable is the default value for
+@code{fringe-cursor-alist} in buffers that do not override it.
+@end defvar
+
+Standard bitmaps for displaying the cursor in right fringe:
+@example
+filled-rectangle hollow-rectangle filled-square hollow-square
+vertical-bar horizontal-bar
+@end example
+
+
 @node Fringe Bitmaps
 @subsection Fringe Bitmaps
 @cindex fringe bitmaps
 @cindex bitmaps, fringe
 
-  The @dfn{fringe bitmaps} are tiny icons Emacs displays in the window
-fringe (on a graphic display) to indicate truncated or continued
-lines, buffer boundaries, overlay arrow, etc.  The fringe bitmaps are
-shared by all frames and windows.  You can redefine the built-in
-fringe bitmaps, and you can define new fringe bitmaps.
+  The @dfn{fringe bitmaps} are the actual bitmaps which represent the
+logical fringe indicators for truncated or continued lines, buffer
+boundaries, overlay arrow, etc.  Fringe bitmap symbols have their own
+name space.  The fringe bitmaps are shared by all frames and windows.
+You can redefine the built-in fringe bitmaps, and you can define new
+fringe bitmaps.
 
   The way to display a bitmap in the left or right fringes for a given
 line in a window is by specifying the @code{display} property for one
@@ -2922,32 +3020,6 @@ default @code{fringe} face.  @var{face} is automatically merged with
 the @code{fringe} face, so normally @var{face} need only specify the
 foreground color for the bitmap.
 
-  These symbols identify the standard fringe bitmaps.  Evaluate
-@code{(require 'fringe)} to define them.  Fringe bitmap symbols have
-their own name space.
-
-@table @asis
-@item Truncation and continuation line bitmaps:
-@code{left-truncation}, @code{right-truncation},
-@code{continued-line}, @code{continuation-line}.
-
-@item Buffer indication bitmaps:
-@code{up-arrow}, @code{down-arrow},
-@code{top-left-angle}, @code{top-right-angle},
-@code{bottom-left-angle}, @code{bottom-right-angle},
-@code{left-bracket}, @code{right-bracket}.
-
-@item Empty line indication bitmap:
-@code{empty-line}.
-
-@item Overlay arrow bitmap:
-@code{overlay-arrow}.
-
-@item Bitmaps for displaying the cursor in right fringe:
-@code{filled-box-cursor}, @code{hollow-box-cursor}, @code{hollow-square},
-@code{bar-cursor}, @code{hbar-cursor}.
-@end table
-
 @defun fringe-bitmaps-at-pos &optional pos window
 This function returns the fringe bitmaps of the display line
 containing position @var{pos} in window @var{window}.  The return
@@ -2990,12 +3062,6 @@ The @var{align} argument may also be a list @code{(@var{align}
 If @var{periodic} is non-@code{nil}, it specifies that the rows in
 @code{bits} should be repeated enough times to reach the specified
 height.
-
-The return value on success is an integer identifying the new bitmap.
-You should save that integer in a variable so it can be used to select
-this bitmap.
-
-This function signals an error if there are no more free bitmap slots.
 @end defun
 
 @defun destroy-fringe-bitmap bitmap
@@ -3016,7 +3082,7 @@ bitmap's face controls the color to draw it in.
 
 @node Overlay Arrow
 @subsection The Overlay Arrow
-@cindex overlay arrow
+@c @cindex overlay arrow  Duplicates variable names
 
   The @dfn{overlay arrow} is useful for directing the user's attention
 to a particular line in a buffer.  For example, in the modes used for
@@ -3040,9 +3106,12 @@ otherwise appear.  Since the arrow is usually short, and the line
 usually begins with indentation, normally nothing significant is
 overwritten.
 
-The overlay string is displayed only in the buffer that this marker
-points into.  Thus, only one buffer can have an overlay arrow at any
-given time.
+The overlay-arrow string is displayed in any given buffer if the value
+of @code{overlay-arrow-position} in that buffer points into that
+buffer.  Thus, it works to can display multiple overlay arrow strings
+by creating buffer-local bindings of @code{overlay-arrow-position}.
+However, it is usually cleaner to use
+@code{overlay-arrow-variable-list} to achieve this result.
 @c !!! overlay-arrow-position: but the overlay string may remain in the display
 @c of some other buffer until an update is required.  This should be fixed
 @c now.  Is it?
@@ -3066,11 +3135,12 @@ Each variable on this list can have properties
 specify an overlay arrow string (for text-only terminals) or fringe
 bitmap (for graphical terminals) to display at the corresponding
 overlay arrow position.  If either property is not set, the default
-(@code{overlay-arrow-string} or @code{overlay-arrow-fringe-bitmap}) is
-used.
+@code{overlay-arrow-string} or @code{overlay-arrow} fringe indicator
+is used.
 
 @node Scroll Bars
 @section Scroll Bars
+@cindex scroll bars
 
 Normally the frame parameter @code{vertical-scroll-bars} controls
 whether the windows in the frame have vertical scroll bars, and
@@ -3158,26 +3228,6 @@ buffer's scroll bars, measured in pixels.  A value of @code{nil} means
 to use the value specified by the frame.
 @end defvar
 
-@node Pointer Shape
-@section Pointer Shape
-
-  Normally, the mouse pointer has the @code{text} shape over text and
-the @code{arrow} shape over window areas which do not correspond to
-any buffer text.  You can specify the mouse pointer shape over text or
-images via the @code{pointer} text property, and for images with the
-@code{:pointer} and @code{:map} image properties.
-
-  The available pointer shapes are: @code{text} (or @code{nil}),
-@code{arrow}, @code{hand}, @code{vdrag}, @code{hdrag},
-@code{modeline}, and @code{hourglass}.
-
-@defvar void-text-area-pointer
-@tindex void-text-area-pointer
-This variable specifies the mouse pointer shape in void text areas,
-i.e. the areas after the end of a line or below the last line in the
-buffer.  The default is to use the @code{arrow} (non-text) pointer.
-@end defvar
-
 @node Display Property
 @section The @code{display} Property
 @cindex display specification
@@ -3187,15 +3237,21 @@ buffer.  The default is to use the @code{arrow} (non-text) pointer.
 insert images into text, and also control other aspects of how text
 displays.  The value of the @code{display} property should be a
 display specification, or a list or vector containing several display
-specifications.
-
-  Some kinds of @code{display} properties specify something to display
-instead of the text that has the property.  In this case, ``the text''
-means all the consecutive characters that have the same Lisp object as
-their @code{display} property; these characters are replaced as a
-single unit.  By contrast, characters that have similar but distinct
-Lisp objects as their @code{display} properties are handled
-separately.  Here's a function that illustrates this point:
+specifications.  Display specifications generally apply in parallel to
+the text they cover.
+
+  Some kinds of @code{display} specifications specify something to
+display instead of the text that has the property.  If a list of
+display specifications includes more than one of this kind, the first
+is effective and the rest are ignored.  You cannot interactively move
+point into the middle of the text that is thus replaced.
+
+  For these specifications, ``the text that has the property'' means
+all the consecutive characters that have the same Lisp object as their
+@code{display} property; these characters are replaced as a single
+unit.  By contrast, characters that have similar but distinct Lisp
+objects as their @code{display} properties are handled separately.
+Here's a function that illustrates this point:
 
 @smallexample
 (defun foo ()
@@ -3223,7 +3279,7 @@ results:
   (goto-char (point-min))
   (dotimes (i 5)
     (let ((string (concat "A")))
-      (put-text-property (point) (2+ (point)) 'display string)
+      (put-text-property (point) (+ 2 (point)) 'display string)
       (put-text-property (point) (1+ (point)) 'display string)
       (forward-char 2))))
 @end smallexample
@@ -3250,7 +3306,6 @@ display specifications and what they mean.
 @node Specified Space
 @subsection Specified Spaces
 @cindex spaces, specified height or width
-@cindex specified spaces
 @cindex variable-width spaces
 
   To display a space of specified width and/or height, use a display
@@ -3392,6 +3447,9 @@ in the @code{display} text property.
 @item @var{string}
 Display @var{string} instead of the text that has this property.
 
+Recursive display specifications are not supported---@var{string}'s
+@code{display} properties, if any, are not used.
+
 @item (image . @var{image-props})
 This kind of display specification is an image descriptor (@pxref{Images}).
 When used as a display specification, it means to display the image
@@ -3407,14 +3465,11 @@ in the range 0.0--1.0 stands for that fraction of the width or height
 of the entire image.
 
 @item ((margin nil) @var{string})
-@itemx @var{string}
 A display specification of this form means to display @var{string}
 instead of the text that has the display specification, at the same
-position as that text.  This is a special case of marginal display
-(@pxref{Display Margins}).
-
-Recursive display specifications are not supported---string display
-specifications must not have @code{display} properties themselves.
+position as that text.  It is equivalent to using just @var{string},
+but it is done as a special case of marginal display (@pxref{Display
+Margins}).
 
 @item (space-width @var{factor})
 This display specification affects all the space characters within the
@@ -3466,9 +3521,13 @@ not affect the amount of raising or lowering, which is based on the
 faces used for the text.
 @end table
 
+@c We put all the `@code{(when ...)}' on one line to encourage
+@c makeinfo's end-of-sentence heuristics to DTRT.  Previously, the dot
+@c was at eol; the info file ended up w/ two spaces rendered after it.
   You can make any display specification conditional.  To do that,
-package it in another list of the form @code{(when @var{condition} .
-@var{spec})}.  Then the specification @var{spec} applies only when
+package it in another list of the form
+@code{(when @var{condition} . @var{spec})}.
+Then the specification @var{spec} applies only when
 @var{condition} evaluates to a non-@code{nil} value.  During the
 evaluation, @code{object} is bound to the string or buffer having the
 conditional @code{display} property.  @code{position} and
@@ -3507,13 +3566,11 @@ them a nonzero width.  The usual way to do that is to set these
 variables:
 
 @defvar left-margin-width
-@tindex left-margin-width
 This variable specifies the width of the left margin.
 It is buffer-local in all buffers.
 @end defvar
 
 @defvar right-margin-width
-@tindex right-margin-width
 This variable specifies the width of the right margin.
 It is buffer-local in all buffers.
 @end defvar
@@ -3526,14 +3583,12 @@ Thus, you can make changes take effect by calling
   You can also set the margin widths immediately.
 
 @defun set-window-margins window left &optional right
-@tindex set-window-margins
 This function specifies the margin widths for window @var{window}.
 The argument @var{left} controls the left margin and
 @var{right} controls the right margin (default @code{0}).
 @end defun
 
 @defun window-margins &optional window
-@tindex window-margins
 This function returns the left and right margins of @var{window}
 as a cons cell of the form @code{(@var{left} . @var{right})}.
 If @var{window} is @code{nil}, the selected window is used.
@@ -3547,6 +3602,13 @@ If @var{window} is @code{nil}, the selected window is used.
 descriptor, then use it as a display specifier in the @code{display}
 property of text that is displayed (@pxref{Display Property}).
 
+  Emacs is usually able to display images when it is run on a
+graphical terminal.  Images cannot be displayed in a text terminal, on
+certain graphical terminals that lack the support for this, or if
+Emacs is compiled without image support.  You can use the function
+@code{display-images-p} to determine if images can in principle be
+displayed (@pxref{Display Feature Testing}).
+
   Emacs can display a number of different image formats; some of them
 are supported only if particular support libraries are installed on
 your machine.  In some environments, Emacs can load image
@@ -3556,7 +3618,7 @@ libraries (though it is not possible to add new image formats).
 
   The supported image formats include XBM, XPM (this requires the
 libraries @code{libXpm} version 3.4k and @code{libz}), GIF (requiring
-@code{libungif} 4.1.0), Postscript, PBM, JPEG (requiring the
+@code{libungif} 4.1.0), PostScript, PBM, JPEG (requiring the
 @code{libjpeg} library version v6a), TIFF (requiring @code{libtiff}
 v3.4), and PNG (requiring @code{libpng} 1.0.2).
 
@@ -3593,9 +3655,7 @@ This variable is ignored if the image libraries are statically linked
 into Emacs.
 @end defvar
 
-@defun  image-type-available-p type
-@findex image-type-available-p
-
+@defun image-type-available-p type
 This function returns non-@code{nil} if image type @var{type} is
 available, i.e., if images of this type can be loaded and displayed in
 Emacs.  @var{type} should be one of the types contained in
@@ -3611,7 +3671,7 @@ function always returns @code{t}; for other image types, it returns
 * XBM Images::          Special features for XBM format.
 * XPM Images::          Special features for XPM format.
 * GIF Images::          Special features for GIF format.
-* Postscript Images::   Special features for Postscript format.
+* PostScript Images::   Special features for PostScript format.
 * Other Image Types::   Various other formats are supported.
 * Defining Images::     Convenient ways to define an image for later use.
 * Showing Images::      Convenient ways to display an image once it is defined.
@@ -3622,12 +3682,11 @@ function always returns @code{t}; for other image types, it returns
 @subsection Image Descriptors
 @cindex image descriptor
 
-  An image description is a list of the form @code{(image
-. @var{props})}, where @var{props} is a property list containing
-alternating keyword symbols (symbols whose names start with a colon) and
-their values.  You can use any Lisp object as a property, but the only
-properties that have any special meaning are certain symbols, all of
-them keywords.
+  An image description is a list of the form @code{(image . @var{props})},
+where @var{props} is a property list containing alternating keyword
+symbols (symbols whose names start with a colon) and their values.
+You can use any Lisp object as a property, but the only properties
+that have any special meaning are certain symbols, all of them keywords.
 
   Every image descriptor must contain the property @code{:type
 @var{type}} to specify the format of the image.  The value of @var{type}
@@ -3761,7 +3820,7 @@ $$\pmatrix{ 2 & -1 &  0 \cr
 @end ifnottex
 
 @item disabled
-Specifies transforming the image so that it looks ``disabled''.
+Specifies transforming the image so that it looks ``disabled.''
 @end table
 
 @item :mask @var{mask}
@@ -3803,11 +3862,11 @@ A polygon is a cons
 @code{(poly . [@var{x0} @var{y0} @var{x1} @var{y1} ...])}
 where each pair in the vector describes one corner in the polygon.
 
-When the mouse pointer is above a hot-spot area of an image, the
+When the mouse pointer lies on a hot-spot area of an image, the
 @var{plist} of that hot-spot is consulted; if it contains a @code{help-echo}
-property it defines a tool-tip for the hot-spot, and if it contains
-a @code{pointer} property, it defines the shape of the mouse cursor when
-it is over the hot-spot.
+property, that defines a tool-tip for the hot-spot, and if it contains
+a @code{pointer} property, that defines the shape of the mouse cursor when
+it is on the hot-spot.
 @xref{Pointer Shape}, for available pointer shapes.
 
 When you click the mouse when the mouse pointer is over a hot-spot, an
@@ -3817,7 +3876,6 @@ mouse event; for instance, @code{[area4 mouse-1]} if the hot-spot's
 @end table
 
 @defun image-mask-p spec &optional frame
-@tindex image-mask-p
 This function returns @code{t} if image @var{spec} has a mask bitmap.
 @var{frame} is the frame on which the image will be displayed.
 @var{frame} @code{nil} or omitted means to use the selected frame
@@ -3935,11 +3993,11 @@ every 0.1 seconds.
     (run-with-timer 0.1 nil 'display-anim buffer file (1+ idx) max nil)))
 @end ignore
 
-@node Postscript Images
-@subsection Postscript Images
-@cindex Postscript images
+@node PostScript Images
+@subsection PostScript Images
+@cindex postscript images
 
-  To use Postscript for an image, specify image type @code{postscript}.
+  To use PostScript for an image, specify image type @code{postscript}.
 This works only if you have Ghostscript installed.  You must always use
 these three properties:
 
@@ -3954,15 +4012,15 @@ The value, @var{height}, specifies the height of the image in points
 
 @item :bounding-box @var{box}
 The value, @var{box}, must be a list or vector of four integers, which
-specifying the bounding box of the Postscript image, analogous to the
-@samp{BoundingBox} comment found in Postscript files.
+specifying the bounding box of the PostScript image, analogous to the
+@samp{BoundingBox} comment found in PostScript files.
 
 @example
 %%BoundingBox: 22 171 567 738
 @end example
 @end table
 
-  Displaying Postscript images from Lisp data is not currently
+  Displaying PostScript images from Lisp data is not currently
 implemented, but it may be implemented by the time you read this.
 See the @file{etc/NEWS} file to make sure.
 
@@ -4001,7 +4059,6 @@ background color.
 @code{find-image} provide convenient ways to create image descriptors.
 
 @defun create-image file-or-data &optional type data-p &rest props
-@tindex create-image
 This function creates and returns an image descriptor which uses the
 data in @var{file-or-data}.  @var{file-or-data} can be a file name or
 a string containing the image data; @var{data-p} should be @code{nil}
@@ -4024,7 +4081,6 @@ supported.  Otherwise it returns an image descriptor.
 @end defun
 
 @defmac defimage symbol specs &optional doc
-@tindex defimage
 This macro defines @var{symbol} as an image name.  The arguments
 @var{specs} is a list which specifies how to display the image.
 The third argument, @var{doc}, is an optional documentation string.
@@ -4053,7 +4109,6 @@ as @code{nil}.
 @end defmac
 
 @defun find-image specs
-@tindex find-image
 This function provides a convenient way to find an image satisfying one
 of a list of image specifications @var{specs}.
 
@@ -4067,8 +4122,62 @@ The first specification in the list whose @var{type} is supported, and
 @var{file} exists, is used to construct the image specification to be
 returned.  If no specification is satisfied, @code{nil} is returned.
 
-The image is looked for first on @code{load-path} and then in
-@code{data-directory}.
+The image is looked for in @code{image-load-path}.
+@end defun
+
+@defvar image-load-path
+This variable's value is a list of locations in which to search for
+image files.  If an element is a string or a variable symbol whose
+value is a string, the string is taken to be the name of a directory
+to search.  If an element is a variable symbol whose value is a list,
+that is taken to be a list of directory names to search.
+
+The default is to search in the @file{images} subdirectory of the
+directory specified by @code{data-directory}, then the directory
+specified by @code{data-directory}, and finally in the directories in
+@code{load-path}.  Subdirectories are not automatically included in
+the search, so if you put an image file in a subdirectory, you have to
+supply the subdirectory name explicitly.  For example, to find the
+image @file{images/foo/bar.xpm} within @code{data-directory}, you
+should specify the image as follows:
+
+@example
+(defimage foo-image '((:type xpm :file "foo/bar.xpm")))
+@end example
+@end defvar
+
+@defun image-load-path-for-library library image &optional path no-error
+This function returns a suitable search path for images used by the
+Lisp package @var{library}.
+
+The function searches for @var{image} first using @code{image-load-path},
+excluding @file{@code{data-directory}/images}, and then in
+@code{load-path}, followed by a path suitable for @var{library}, which
+includes @file{../../etc/images} and @file{../etc/images} relative to
+the library file itself, and finally in
+@file{@code{data-directory}/images}.
+
+Then this function returns a list of directories which contains first
+the directory in which @var{image} was found, followed by the value of
+@code{load-path}.  If @var{path} is given, it is used instead of
+@code{load-path}.
+
+If @var{no-error} is non-@code{nil} and a suitable path can't be
+found, don't signal an error.  Instead, return a list of directories as
+before, except that @code{nil} appears in place of the image directory.
+
+Here is an example that uses a common idiom to provide compatibility
+with versions of Emacs that lack the variable @code{image-load-path}:
+
+@example
+(defvar image-load-path) ; shush compiler
+(let* ((load-path (image-load-path-for-library
+                        "mh-e" "mh-logo.xpm"))
+       (image-load-path (cons (car load-path)
+                              (when (boundp 'image-load-path)
+                                image-load-path))))
+  (mh-tool-bar-folder-buttons-init))
+@end example
 @end defun
 
 @node Showing Images
@@ -4144,7 +4253,6 @@ This removes only images that were put into @var{buffer} the way
 @end defun
 
 @defun image-size spec &optional pixels frame
-@tindex image-size
 This function returns the size of an image as a pair
 @w{@code{(@var{width} . @var{height})}}.  @var{spec} is an image
 specification.  @var{pixels} non-@code{nil} means return sizes
@@ -4155,19 +4263,67 @@ font).  @var{frame} is the frame on which the image will be displayed.
 Focus}).
 @end defun
 
+@defvar max-image-size
+This variable is used to define the maximum size of image that Emacs
+will load.  Emacs will refuse to load (and display) any image that is
+larger than this limit.
+
+If the value is an integer, it directly specifies the maximum
+image height and width, measured in pixels.  If it is a floating
+point number, it specifies the maximum image height and width
+as a ratio to the frame height and width.  If the value is
+non-numeric, there is no explicit limit on the size of images.
+
+The purpose of this variable is to prevent unreasonably large images
+from accidentally being loaded into Emacs.  It only takes effect the
+first time an image is loaded.  Once an image is placed in the image
+cache, it can always be displayed, even if the value of
+@var{max-image-size} is subsequently changed (@pxref{Image Cache}).
+@end defvar
+
 @node Image Cache
 @subsection Image Cache
+@cindex image cache
+
+  Emacs stores images in an image cache so that it can display them
+again more efficiently.  When Emacs displays an image, it searches the
+image cache for an existing image specification @code{equal} to the
+desired specification.  If a match is found, the image is displayed
+from the cache; otherwise, Emacs loads the image normally.
+
+  Occasionally, you may need to tell Emacs to refresh the images
+associated with a given image specification.  For example, suppose you
+display an image using a specification that contains a @code{:file}
+property.  The image is loaded from the given file and stored in the
+image cache.  If you later display the image again, using the same
+image specification, the image is displayed from the image cache.
+Normally, this is not a problem.  However, if the image file has
+changed in the meantime, Emacs would be displaying the old version of
+the image.  In such a situation, it is necessary to ``refresh'' the
+image using @code{image-refresh}.
+
+@defun image-refresh spec &optional frame
+This function refreshes any images having image specifications
+@code{equal} to @var{spec} on frame @var{frame}.  If @var{frame} is
+@code{nil}, the selected frame is used.  If @var{frame} is @code{t},
+the refresh is applied to all existing frames.
+
+This works by removing all image with image specifications matching
+@var{spec} from the image cache.  Thus, the next time the image is
+displayed, Emacs will load the image again.
+@end defun
 
-  Emacs stores images in an image cache when it displays them, so it can
-display them again more efficiently.  It removes an image from the cache
-when it hasn't been displayed for a specified period of time.
+@defun clear-image-cache &optional frame
+This function clears the entire image cache.  If @var{frame} is
+non-@code{nil}, only the cache for that frame is cleared.  Otherwise,
+all frames' caches are cleared.
+@end defun
 
-When an image is looked up in the cache, its specification is compared
-with cached image specifications using @code{equal}.  This means that
-all images with equal specifications share the same image in the cache.
+If an image in the image cache has not been displayed for a specified
+period of time, Emacs removes it from the cache and frees the
+associated memory.
 
 @defvar image-cache-eviction-delay
-@tindex image-cache-eviction-delay
 This variable specifies the number of seconds an image can remain in the
 cache without being displayed.  When an image is not displayed for this
 length of time, Emacs removes it from the image cache.
@@ -4177,16 +4333,8 @@ except when you explicitly clear it.  This mode can be useful for
 debugging.
 @end defvar
 
-@defun clear-image-cache &optional frame
-@tindex clear-image-cache
-This function clears the image cache.  If @var{frame} is non-@code{nil},
-only the cache for that frame is cleared.  Otherwise all frames' caches
-are cleared.
-@end defun
-
 @node Buttons
 @section Buttons
-@cindex buttons
 @cindex buttons in buffers
 @cindex clickable buttons in buffers
 
@@ -4199,7 +4347,7 @@ etc.  Emacs uses buttons for the hyper-links in help text and the like.
 properties or overlays) to a region of text in an Emacs buffer.  These
 properties are called @dfn{button properties}.
 
-  One of the these properties (@code{action}) is a function, which will
+  One of these properties (@code{action}) is a function, which will
 be called when the user invokes it using the keyboard or the mouse.
 The invoked function may then examine the button and use its other
 properties as desired.
@@ -4300,7 +4448,6 @@ so that it's easy to define special-purpose types of buttons for
 specific tasks.
 
 @defun define-button-type name &rest properties
-@tindex define-button-type
 Define a `button type' called @var{name}.  The remaining arguments
 form a sequence of @var{property value} pairs, specifying default
 property values for buttons with this type (a button's type may be set
@@ -4333,8 +4480,8 @@ this is a simple underline, like a typical web-page link.
 
   For convenience, there are two sorts of button-creation functions,
 those that add button properties to an existing region of a buffer,
-called @code{make-...button}, and those also insert the button text,
-called @code{insert-...button}.
+called @code{make-...button}, and those that also insert the button
+text, called @code{insert-...button}.
 
   The button-creation functions all take the @code{&rest} argument
 @var{properties}, which should be a sequence of @var{property value}
@@ -4349,13 +4496,11 @@ defines such a property).
 (@pxref{Overlays}) to hold the button properties:
 
 @defun make-button beg end &rest properties
-@tindex make-button
 This makes a button from @var{beg} to @var{end} in the
 current buffer, and returns it.
 @end defun
 
 @defun insert-button label &rest properties
-@tindex insert-button
 This insert a button with the label @var{label} at point,
 and returns it.
 @end defun
@@ -4369,13 +4514,11 @@ numbers of buttons.  Both functions return the position of the start
 of the new button:
 
 @defun make-text-button beg end &rest properties
-@tindex make-text-button
 This makes a button from @var{beg} to @var{end} in the current buffer, using
 text properties.
 @end defun
 
 @defun insert-text-button label &rest properties
-@tindex insert-text-button
 This inserts a button with the label @var{label} at point, using text
 properties.
 @end defun
@@ -4395,27 +4538,22 @@ Such an object is passed as the first argument to a button's
 invocation function when it is invoked.
 
 @defun button-start button
-@tindex button-start
 Return the position at which @var{button} starts.
 @end defun
 
 @defun button-end button
-@tindex button-end
 Return the position at which @var{button} ends.
 @end defun
 
 @defun button-get button prop
-@tindex button-get
 Get the property of button @var{button} named @var{prop}.
 @end defun
 
 @defun button-put button prop val
-@tindex button-put
 Set @var{button}'s @var{prop} property to @var{val}.
 @end defun
 
 @defun button-activate button &optional use-mouse-action
-@tindex button-activate
 Call @var{button}'s @code{action} property (i.e., invoke it).  If
 @var{use-mouse-action} is non-@code{nil}, try to invoke the button's
 @code{mouse-action} property instead of @code{action}; if the button
@@ -4423,38 +4561,31 @@ has no @code{mouse-action} property, use @code{action} as normal.
 @end defun
 
 @defun button-label button
-@tindex button-label
 Return @var{button}'s text label.
 @end defun
 
 @defun button-type button
-@tindex button-type
 Return @var{button}'s button-type.
 @end defun
 
 @defun button-has-type-p button type
-@tindex button-has-type-p
 Return @code{t} if @var{button} has button-type @var{type}, or one of
 @var{type}'s subtypes.
 @end defun
 
 @defun button-at pos
-@tindex button-at
 Return the button at position @var{pos} in the current buffer, or @code{nil}.
 @end defun
 
 @defun button-type-put type prop val
-@tindex button-type-put
 Set the button-type @var{type}'s @var{prop} property to @var{val}.
 @end defun
 
 @defun button-type-get type prop
-@tindex button-type-get
 Get the property of button-type @var{type} named @var{prop}.
 @end defun
 
 @defun button-type-subtype-p type supertype
-@tindex button-type-subtype-p
 Return @code{t} if button-type @var{type} is a subtype of @var{supertype}.
 @end defun
 
@@ -4480,7 +4611,6 @@ will also activate the @code{push-button} command.
 @xref{Links and Mouse-1}.
 
 @deffn Command push-button &optional pos use-mouse-action
-@tindex push-button
 Perform the action specified by a button at location @var{pos}.
 @var{pos} may be either a buffer position or a mouse-event.  If
 @var{use-mouse-action} is non-@code{nil}, or @var{pos} is a
@@ -4494,7 +4624,6 @@ nothing and return @code{nil}, otherwise return @code{t}.
 @end deffn
 
 @deffn Command forward-button n &optional wrap display-message
-@tindex forward-button
 Move to the @var{n}th next button, or @var{n}th previous button if
 @var{n} is negative.  If @var{n} is zero, move to the start of any
 button at point.  If @var{wrap} is non-@code{nil}, moving past either
@@ -4505,7 +4634,6 @@ is skipped over.  Returns the button found.
 @end deffn
 
 @deffn Command backward-button n &optional wrap display-message
-@tindex backward-button
 Move to the @var{n}th previous button, or @var{n}th next button if
 @var{n} is negative.  If @var{n} is zero, move to the start of any
 button at point.  If @var{wrap} is non-@code{nil}, moving past either
@@ -4516,25 +4644,351 @@ is skipped over.  Returns the button found.
 @end deffn
 
 @defun next-button pos &optional count-current
-@tindex next-button
-Return the next button after position @var{pos} in the current buffer.
-If @var{count-current} is non-@code{nil}, count any button at
-@var{pos} in the search, instead of starting at the next button.
+@defunx previous-button pos &optional count-current
+Return the next button after (for @code{next-button} or before (for
+@code{previous-button}) position @var{pos} in the current buffer.  If
+@var{count-current} is non-@code{nil}, count any button at @var{pos}
+in the search, instead of starting at the next button.
+@end defun
+
+@node Abstract Display
+@section Abstract Display
+@cindex ewoc
+@cindex display, abstract
+@cindex display, arbitrary objects
+@cindex model/view/controller
+@cindex view part, model/view/controller
+
+  The Ewoc package constructs buffer text that represents a structure
+of Lisp objects, and updates the text to follow changes in that
+structure.  This is like the ``view'' component in the
+``model/view/controller'' design paradigm.
+
+  An @dfn{ewoc} is a structure that organizes information required to
+construct buffer text that represents certain Lisp data.  The buffer
+text of the ewoc has three parts, in order: first, fixed @dfn{header}
+text; next, textual descriptions of a series of data elements (Lisp
+objects that you specify); and last, fixed @dfn{footer} text.
+Specifically, an ewoc contains information on:
+
+@itemize @bullet
+@item
+The buffer which its text is generated in.
+
+@item
+The text's start position in the buffer.
+
+@item
+The header and footer strings.
+
+@item
+A doubly-linked chain of @dfn{nodes}, each of which contains:
+
+@itemize
+@item
+A @dfn{data element}, a single Lisp object.
+
+@item
+Links to the preceding and following nodes in the chain.
+@end itemize
+
+@item
+A @dfn{pretty-printer} function which is responsible for
+inserting the textual representation of a data
+element value into the current buffer.
+@end itemize
+
+  Typically, you define an ewoc with @code{ewoc-create}, and then pass
+the resulting ewoc structure to other functions in the Ewoc package to
+build nodes within it, and display it in the buffer.  Once it is
+displayed in the buffer, other functions determine the correspondance
+between buffer positions and nodes, move point from one node's textual
+representation to another, and so forth.  @xref{Abstract Display
+Functions}.
+
+  A node @dfn{encapsulates} a data element much the way a variable
+holds a value.  Normally, encapsulation occurs as a part of adding a
+node to the ewoc.  You can retrieve the data element value and place a
+new value in its place, like so:
+
+@lisp
+(ewoc-data @var{node})
+@result{} value
+
+(ewoc-set-data @var{node} @var{new-value})
+@result{} @var{new-value}
+@end lisp
+
+@noindent
+You can also use, as the data element value, a Lisp object (list or
+vector) that is a container for the ``real'' value, or an index into
+some other structure.  The example (@pxref{Abstract Display Example})
+uses the latter approach.
+
+  When the data changes, you will want to update the text in the
+buffer.  You can update all nodes by calling @code{ewoc-refresh}, or
+just specific nodes using @code{ewoc-invalidate}, or all nodes
+satisfying a predicate using @code{ewoc-map}.  Alternatively, you can
+delete invalid nodes using @code{ewoc-delete} or @code{ewoc-filter},
+and add new nodes in their place.  Deleting a node from an ewoc deletes
+its associated textual description from buffer, as well.
+
+@menu
+* Abstract Display Functions::
+* Abstract Display Example::
+@end menu
+
+@node Abstract Display Functions
+@subsection Abstract Display Functions
+
+  In this subsection, @var{ewoc} and @var{node} stand for the
+structures described above (@pxref{Abstract Display}), while
+@var{data} stands for an arbitrary Lisp object used as a data element.
+
+@defun ewoc-create pretty-printer &optional header footer nosep
+This constructs and returns a new ewoc, with no nodes (and thus no data
+elements).  @var{pretty-printer} should be a function that takes one
+argument, a data element of the sort you plan to use in this ewoc, and
+inserts its textual description at point using @code{insert} (and never
+@code{insert-before-markers}, because that would interfere with the
+Ewoc package's internal mechanisms).
+
+Normally, a newline is automatically inserted after the header,
+the footer and every node's textual description.  If @var{nosep}
+is non-@code{nil}, no newline is inserted.  This may be useful for
+displaying an entire ewoc on a single line, for example, or for
+making nodes ``invisible'' by arranging for @var{pretty-printer}
+to do nothing for those nodes.
+
+An ewoc maintains its text in the buffer that is current when
+you create it, so switch to the intended buffer before calling
+@code{ewoc-create}.
+@end defun
+
+@defun ewoc-buffer ewoc
+This returns the buffer where @var{ewoc} maintains its text.
+@end defun
+
+@defun ewoc-get-hf ewoc
+This returns a cons cell @code{(@var{header} . @var{footer})}
+made from @var{ewoc}'s header and footer.
+@end defun
+
+@defun ewoc-set-hf ewoc header footer
+This sets the header and footer of @var{ewoc} to the strings
+@var{header} and @var{footer}, respectively.
+@end defun
+
+@defun ewoc-enter-first ewoc data
+@defunx ewoc-enter-last ewoc data
+These add a new node encapsulating @var{data}, putting it, respectively,
+at the beginning or end of @var{ewoc}'s chain of nodes.
+@end defun
+
+@defun ewoc-enter-before ewoc node data
+@defunx ewoc-enter-after ewoc node data
+These add a new node encapsulating @var{data}, adding it to
+@var{ewoc} before or after @var{node}, respectively.
+@end defun
+
+@defun ewoc-prev ewoc node
+@defunx ewoc-next ewoc node
+These return, respectively, the previous node and the next node of @var{node}
+in @var{ewoc}.
+@end defun
+
+@defun ewoc-nth ewoc n
+This returns the node in @var{ewoc} found at zero-based index @var{n}.
+A negative @var{n} means count from the end.  @code{ewoc-nth} returns
+@code{nil} if @var{n} is out of range.
+@end defun
+
+@defun ewoc-data node
+This extracts the data encapsulated by @var{node} and returns it.
+@end defun
+
+@defun ewoc-set-data node data
+This sets the data encapsulated by @var{node} to @var{data}.
+@end defun
+
+@defun ewoc-locate ewoc &optional pos guess
+This determines the node in @var{ewoc} which contains point (or
+@var{pos} if specified), and returns that node.  If @var{ewoc} has no
+nodes, it returns @code{nil}.  If @var{pos} is before the first node,
+it returns the first node; if @var{pos} is after the last node, it returns
+the last node.  The optional third arg @var{guess}
+should be a node that is likely to be near @var{pos}; this doesn't
+alter the result, but makes the function run faster.
+@end defun
+
+@defun ewoc-location node
+This returns the start position of @var{node}.
+@end defun
+
+@defun ewoc-goto-prev ewoc arg
+@defunx ewoc-goto-next ewoc arg
+These move point to the previous or next, respectively, @var{arg}th node
+in @var{ewoc}.  @code{ewoc-goto-prev} does not move if it is already at
+the first node or if @var{ewoc} is empty, whereas @code{ewoc-goto-next}
+moves past the last node, returning @code{nil}.  Excepting this special
+case, these functions return the node moved to.
+@end defun
+
+@defun ewoc-goto-node ewoc node
+This moves point to the start of @var{node} in @var{ewoc}.
+@end defun
+
+@defun ewoc-refresh ewoc
+This function regenerates the text of @var{ewoc}.  It works by
+deleting the text between the header and the footer, i.e., all the
+data elements' representations, and then calling the pretty-printer
+function for each node, one by one, in order.
 @end defun
 
-@defun previous-button pos &optional count-current
-@tindex previous-button
-Return the @var{n}th button before position @var{pos} in the current
-buffer.  If @var{count-current} is non-@code{nil}, count any button at
-@var{pos} in the search, instead of starting at the next button.
+@defun ewoc-invalidate ewoc &rest nodes
+This is similar to @code{ewoc-refresh}, except that only @var{nodes} in
+@var{ewoc} are updated instead of the entire set.
 @end defun
 
+@defun ewoc-delete ewoc &rest nodes
+This deletes each node in @var{nodes} from @var{ewoc}.
+@end defun
+
+@defun ewoc-filter ewoc predicate &rest args
+This calls @var{predicate} for each data element in @var{ewoc} and
+deletes those nodes for which @var{predicate} returns @code{nil}.
+Any @var{args} are passed to @var{predicate}.
+@end defun
+
+@defun ewoc-collect ewoc predicate &rest args
+This calls @var{predicate} for each data element in @var{ewoc}
+and returns a list of those elements for which @var{predicate}
+returns non-@code{nil}.  The elements in the list are ordered
+as in the buffer.  Any @var{args} are passed to @var{predicate}.
+@end defun
+
+@defun ewoc-map map-function ewoc &rest args
+This calls @var{map-function} for each data element in @var{ewoc} and
+updates those nodes for which @var{map-function} returns non-@code{nil}.
+Any @var{args} are passed to @var{map-function}.
+@end defun
+
+@node Abstract Display Example
+@subsection Abstract Display Example
+
+  Here is a simple example using functions of the ewoc package to
+implement a ``color components display,'' an area in a buffer that
+represents a vector of three integers (itself representing a 24-bit RGB
+value) in various ways.
+
+@example
+(setq colorcomp-ewoc nil
+      colorcomp-data nil
+      colorcomp-mode-map nil
+      colorcomp-labels ["Red" "Green" "Blue"])
+
+(defun colorcomp-pp (data)
+  (if data
+      (let ((comp (aref colorcomp-data data)))
+        (insert (aref colorcomp-labels data) "\t: #x"
+                (format "%02X" comp) " "
+                (make-string (ash comp -2) ?#) "\n"))
+    (let ((cstr (format "#%02X%02X%02X"
+                        (aref colorcomp-data 0)
+                        (aref colorcomp-data 1)
+                        (aref colorcomp-data 2)))
+          (samp " (sample text) "))
+      (insert "Color\t: "
+              (propertize samp 'face `(foreground-color . ,cstr))
+              (propertize samp 'face `(background-color . ,cstr))
+              "\n"))))
+
+(defun colorcomp (color)
+  "Allow fiddling with COLOR in a new buffer.
+The buffer is in Color Components mode."
+  (interactive "sColor (name or #RGB or #RRGGBB): ")
+  (when (string= "" color)
+    (setq color "green"))
+  (unless (color-values color)
+    (error "No such color: %S" color))
+  (switch-to-buffer
+   (generate-new-buffer (format "originally: %s" color)))
+  (kill-all-local-variables)
+  (setq major-mode 'colorcomp-mode
+        mode-name "Color Components")
+  (use-local-map colorcomp-mode-map)
+  (erase-buffer)
+  (buffer-disable-undo)
+  (let ((data (apply 'vector (mapcar (lambda (n) (ash n -8))
+                                     (color-values color))))
+        (ewoc (ewoc-create 'colorcomp-pp
+                           "\nColor Components\n\n"
+                           (substitute-command-keys
+                            "\n\\@{colorcomp-mode-map@}"))))
+    (set (make-local-variable 'colorcomp-data) data)
+    (set (make-local-variable 'colorcomp-ewoc) ewoc)
+    (ewoc-enter-last ewoc 0)
+    (ewoc-enter-last ewoc 1)
+    (ewoc-enter-last ewoc 2)
+    (ewoc-enter-last ewoc nil)))
+@end example
+
+@cindex controller part, model/view/controller
+  This example can be extended to be a ``color selection widget'' (in
+other words, the controller part of the ``model/view/controller''
+design paradigm) by defining commands to modify @code{colorcomp-data}
+and to ``finish'' the selection process, and a keymap to tie it all
+together conveniently.
+
+@smallexample
+(defun colorcomp-mod (index limit delta)
+  (let ((cur (aref colorcomp-data index)))
+    (unless (= limit cur)
+      (aset colorcomp-data index (+ cur delta)))
+    (ewoc-invalidate
+     colorcomp-ewoc
+     (ewoc-nth colorcomp-ewoc index)
+     (ewoc-nth colorcomp-ewoc -1))))
+
+(defun colorcomp-R-more () (interactive) (colorcomp-mod 0 255 1))
+(defun colorcomp-G-more () (interactive) (colorcomp-mod 1 255 1))
+(defun colorcomp-B-more () (interactive) (colorcomp-mod 2 255 1))
+(defun colorcomp-R-less () (interactive) (colorcomp-mod 0 0 -1))
+(defun colorcomp-G-less () (interactive) (colorcomp-mod 1 0 -1))
+(defun colorcomp-B-less () (interactive) (colorcomp-mod 2 0 -1))
+
+(defun colorcomp-copy-as-kill-and-exit ()
+  "Copy the color components into the kill ring and kill the buffer.
+The string is formatted #RRGGBB (hash followed by six hex digits)."
+  (interactive)
+  (kill-new (format "#%02X%02X%02X"
+                    (aref colorcomp-data 0)
+                    (aref colorcomp-data 1)
+                    (aref colorcomp-data 2)))
+  (kill-buffer nil))
+
+(setq colorcomp-mode-map
+      (let ((m (make-sparse-keymap)))
+        (suppress-keymap m)
+        (define-key m "i" 'colorcomp-R-less)
+        (define-key m "o" 'colorcomp-R-more)
+        (define-key m "k" 'colorcomp-G-less)
+        (define-key m "l" 'colorcomp-G-more)
+        (define-key m "," 'colorcomp-B-less)
+        (define-key m "." 'colorcomp-B-more)
+        (define-key m " " 'colorcomp-copy-as-kill-and-exit)
+        m))
+@end smallexample
+
+Note that we never modify the data in each node, which is fixed when the
+ewoc is created to be either @code{nil} or an index into the vector
+@code{colorcomp-data}, the actual color components.
+
 @node Blinking
 @section Blinking Parentheses
 @cindex parenthesis matching
-@cindex blinking
+@cindex blinking parentheses
 @cindex balancing parentheses
-@cindex close parenthesis
 
   This section describes the mechanism by which Emacs shows a matching
 open parenthesis when the user inserts a close parenthesis.
@@ -4667,58 +5121,13 @@ buffers that do not override it.  @xref{Default Value}.
 @end defvar
 
 @defopt tab-width
-The value of this variable is the spacing between tab stops used for
-displaying tab characters in Emacs buffers.  The value is in units of
-columns, and the default is 8.  Note that this feature is completely
-independent of the user-settable tab stops used by the command
-@code{tab-to-tab-stop}.  @xref{Indent Tabs}.
+The value of this buffer-local variable is the spacing between tab
+stops used for displaying tab characters in Emacs buffers.  The value
+is in units of columns, and the default is 8.  Note that this feature
+is completely independent of the user-settable tab stops used by the
+command @code{tab-to-tab-stop}.  @xref{Indent Tabs}.
 @end defopt
 
-@defopt indicate-empty-lines
-@tindex indicate-empty-lines
-@cindex fringes, and empty line indication
-When this is non-@code{nil}, Emacs displays a special glyph in the
-fringe of each empty line at the end of the buffer, on terminals that
-support it (window systems).  @xref{Fringes}.
-@end defopt
-
-@defvar indicate-buffer-boundaries
-This buffer-local variable controls how the buffer boundaries and
-window scrolling are indicated in the window fringes.
-
-Emacs can indicate the buffer boundaries---that is, the first and last
-line in the buffer---with angle icons when they appear on the screen.
-In addition, Emacs can display an up-arrow in the fringe to show
-that there is text above the screen, and a down-arrow to show
-there is text below the screen.
-
-There are four kinds of basic values:
-
-@table @asis
-@item @code{nil}
-Don't display the icons.
-@item @code{left}
-Display them in the left fringe.
-@item @code{right}
-Display them in the right fringe.
-@item @var{anything-else}
-Display the icon at the top of the window top in the left fringe, and other
-in the right fringe.
-@end table
-
-If value is a cons @code{(@var{angles} . @var{arrows})}, @var{angles}
-controls the angle icons, and @var{arrows} controls the arrows.  Both
-@var{angles} and @var{arrows} work according to the table above.
-Thus, @code{(t .  right)} places the top angle icon in the left
-fringe, the bottom angle icon in the right fringe, and both arrows in
-the right fringe.
-@end defvar
-
-@defvar default-indicate-buffer-boundaries
-The value of this variable is the default value for
-@code{indicate-buffer-boundaries} in buffers that do not override it.
-@end defvar
-
 @node Display Tables
 @section Display Tables
 
@@ -4756,13 +5165,14 @@ This creates and returns a display table.  The table initially has
 
   The ordinary elements of the display table are indexed by character
 codes; the element at index @var{c} says how to display the character
-code @var{c}.  The value should be @code{nil} or a vector of glyph
-values (@pxref{Glyphs}).  If an element is @code{nil}, it says to
-display that character according to the usual display conventions
+code @var{c}.  The value should be @code{nil} or a vector of the
+glyphs to be output (@pxref{Glyphs}).  @code{nil} says to display the
+character @var{c} according to the usual display conventions
 (@pxref{Usual Display}).
 
-  If you use the display table to change the display of newline
-characters, the whole buffer will be displayed as one long ``line.''
+  @strong{Warning:} if you use the display table to change the display
+of newline characters, the whole buffer will be displayed as one long
+``line.''
 
   The display table also has six ``extra slots'' which serve special
 purposes.  Here is a table of their meanings; @code{nil} in any slot
@@ -4828,13 +5238,11 @@ This function stores @var{value} in the extra slot @var{slot} of
 @end defun
 
 @defun describe-display-table display-table
-@tindex describe-display-table
 This function displays a description of the display table
 @var{display-table} in a help buffer.
 @end defun
 
 @deffn Command describe-current-display-table
-@tindex describe-current-display-table
 This command displays a description of the current display table in a
 help buffer.
 @end deffn
@@ -4889,65 +5297,70 @@ are defined in the library @file{disp-table}.
 
 @cindex glyph
   A @dfn{glyph} is a generalization of a character; it stands for an
-image that takes up a single character position on the screen.  Glyphs
-are represented in Lisp as integers, just as characters are.  Normally
-Emacs finds glyphs in the display table (@pxref{Display Tables}).
-
-  A glyph can be @dfn{simple} or it can be defined by the @dfn{glyph
-table}.  A simple glyph is just a way of specifying a character and a
-face to output it in.  The glyph code for a simple glyph, mod 524288,
-is the character to output, and the glyph code divided by 524288
-specifies the face number (@pxref{Face Functions}) to use while
-outputting it.  (524288 is
-@ifnottex
-2**19.)
-@end ifnottex
-@tex
-$2^{19}$.)
-@end tex
-@xref{Faces}.
+image that takes up a single character position on the screen.  Normally
+glyphs come from vectors in the display table (@pxref{Display Tables}).
+
+  A glyph is represented in Lisp as a @dfn{glyph code}.  A glyph code
+can be @dfn{simple} or it can be defined by the @dfn{glyph table}.  A
+simple glyph code is just a way of specifying a character and a face
+to output it in.  @xref{Faces}.
+
+  The following functions are used to manipulate simple glyph codes:
+
+@defun make-glyph-code char &optional face
+This function returns a simple glyph code representing char @var{char}
+with face @var{face}.
+@end defun
+
+@defun glyph-char glyph
+This function returns the character of simple glyph code @var{glyph}.
+@end defun
+
+@defun glyph-face glyph
+This function returns face of simple glyph code @var{glyph}, or
+@code{nil} if @var{glyph} has the default face (face-id 0).
+@end defun
 
   On character terminals, you can set up a @dfn{glyph table} to define
-the meaning of glyph codes.  The glyph codes is the value of the
-variable @code{glyph-table}.
+the meaning of glyph codes (represented as small integers).
 
 @defvar glyph-table
-The value of this variable is the current glyph table.  It should be a
-vector; the @var{g}th element defines glyph code @var{g}.
+The value of this variable is the current glyph table.  It should be
+@code{nil} or a vector whose @var{g}th element defines glyph code
+@var{g}.
 
 If a glyph code is greater than or equal to the length of the glyph
-table, that code is automatically simple.  If the value of
-@code{glyph-table} is @code{nil} instead of a vector, then all glyphs
-are simple.  The glyph table is not used on graphical displays, only
-on character terminals.  On graphical displays, all glyphs are simple.
+table, that code is automatically simple.  If @code{glyph-table} is
+@code{nil} then all glyph codes are simple.
+
+The glyph table is used only on character terminals.  On graphical
+displays, all glyph codes are simple.
 @end defvar
 
-  Here are the possible types of elements in the glyph table:
+  Here are the meaningful types of elements in the glyph table:
 
 @table @asis
 @item @var{string}
 Send the characters in @var{string} to the terminal to output
-this glyph.  This alternative is available on character terminals,
-but not under a window system.
+this glyph code.
 
-@item @var{integer}
-Define this glyph code as an alias for glyph code @var{integer}.  You
-can use an alias to specify a face code for the glyph and use a small
-number as its code.
+@item @var{code}
+Define this glyph code as an alias for glyph code @var{code} created
+by @code{make-glyph-code}.  You can use such an alias to define a
+small-numbered glyph code which specifies a character with a face.
 
 @item @code{nil}
-This glyph is simple.
+This glyph code is simple.
 @end table
 
 @defun create-glyph string
-@tindex create-glyph
 This function returns a newly-allocated glyph code which is set up to
 display by sending @var{string} to the terminal.
 @end defun
 
 @node Beeping
 @section Beeping
-@cindex beeping
+@c  @cindex beeping   "beep" is adjacent
 @cindex bell
 
   This section describes how to make Emacs ring the bell (or blink the
@@ -4970,7 +5383,7 @@ This is a synonym for @code{ding}.
 @defopt visible-bell
 This variable determines whether Emacs should flash the screen to
 represent a bell.  Non-@code{nil} means yes, @code{nil} means no.  This
-is effective on a window system, and on a character-only terminal
+is effective on graphical displays, and on text-only terminals
 provided the terminal's Termcap entry defines the visible bell
 capability (@samp{vb}).
 @end defopt
@@ -4986,7 +5399,7 @@ variable.
 @section Window Systems
 
   Emacs works with several window systems, most notably the X Window
-System.  Both Emacs and X use the term ``window'', but use it
+System.  Both Emacs and X use the term ``window,'' but use it
 differently.  An Emacs frame is a single window as far as X is
 concerned; the individual Emacs windows are not known to X at all.