]> code.delx.au - gnu-emacs/blobdiff - doc/lispref/display.texi
Merge from emacs--rel--22
[gnu-emacs] / doc / lispref / display.texi
index db630ba2c512a9c0f8e55a26840548c07a449601..4c9df9c5ede6ad9804848d4b82a06d1b80188a66 100644 (file)
@@ -3,7 +3,7 @@
 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001,
 @c   2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../info/display
+@setfilename ../../info/display
 @node Display, System Interface, Processes, Top
 @chapter Emacs Display
 
@@ -1291,6 +1291,11 @@ while moving an overlay or changing its properties does not.  Unlike
 text property changes, overlay property changes are not recorded in
 the buffer's undo list.
 
+  Since more than one overlay can specify a property value for the
+same character, Emacs lets you specify a priority value of each
+overlay.  You should not make assumptions about which overlay will
+prevail when there is a conflict and they have the same priority.
+
   These functions read and set the properties of an overlay:
 
 @defun overlay-get overlay prop
@@ -1321,13 +1326,16 @@ of them:
 @item priority
 @kindex priority @r{(overlay property)}
 This property's value (which should be a nonnegative integer number)
-determines the priority of the overlay.  The priority matters when two
-or more overlays cover the same character and both specify the same
-property; the one whose @code{priority} value is larger takes priority
-over the other.  For the @code{face} property, the higher priority
-value does not completely replace the other; instead, its face
-attributes override the face attributes of the lower priority
-@code{face} property.
+determines the priority of the overlay.  No priority, or @code{nil},
+means zero.
+
+The priority matters when two or more overlays cover the same
+character and both specify the same property; the one whose
+@code{priority} value is larger overrides the other.  For the
+@code{face} property, the higher priority overlay's value does not
+completely override the other value; instead, its face attributes
+override the face attributes of the lower priority @code{face}
+property.
 
 Currently, all overlays take priority over text properties.  Please
 avoid using negative priority values, as we have not yet decided just
@@ -2510,7 +2518,7 @@ makes @code{modeline} an alias for the @code{mode-line} face.
 @cindex automatic face assignment
 @cindex faces, automatic choice
 
-  This hook is used for automatically assigning facesto text in the
+  This hook is used for automatically assigning faces to text in the
 buffer.  It is part of the implementation of Jit-Lock mode, used by
 Font-Lock.
 
@@ -3237,15 +3245,47 @@ to use the value specified by the frame.
 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.
+specifications.  Display specifications in the same @code{display}
+property value generally apply in parallel to the text they cover.
+
+  If several sources (overlays and/or a text property) specify values
+for the @code{display} property, only one of the values takes effect,
+following the rules of @code{get-char-property}.  @xref{Examining
+Properties}.
+
+  The rest of this section describes several kinds of
+display specifications and what they mean.
+
+@menu
+* Replacing Specs::      Display specs that replace the text.
+* Specified Space::      Displaying one space with a specified width.
+* Pixel Specification::  Specifying space width or height in pixels.
+* Other Display Specs::  Displaying an image; magnifying text; moving it
+                          up or down on the page; adjusting the width
+                          of spaces within text.
+* Display Margins::     Displaying text or images to the side of the main text.
+@end menu
+
+@node Replacing Specs
+@subsection Display Specs That Replace The Text
 
-  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:
+  Some kinds of @code{display} specifications specify something to
+display instead of the text that has the property.  These are called
+@dfn{replacing} display specifications.  Emacs does not allow the user
+to interactively move point into the middle of buffer text that is
+replaced in this way.
+
+  If a list of display specifications includes more than one replacing
+display specification, the first overrides the rest.  Replacing
+display specifications make most other display specifications
+irrelevant, since those don't apply to the replacement.
+
+  For replacing display 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 ()
@@ -3273,7 +3313,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
@@ -3285,18 +3325,6 @@ object as the @code{display} property value, it's irrelevant
 whether they got this property from a single call to
 @code{put-text-property} or from two different calls.
 
-  The rest of this section describes several kinds of
-display specifications and what they mean.
-
-@menu
-* Specified Space::      Displaying one space with a specified width.
-* Pixel Specification::  Specifying space width or height in pixels.
-* Other Display Specs::  Displaying an image; magnifying text; moving it
-                          up or down on the page; adjusting the width
-                          of spaces within text.
-* Display Margins::     Displaying text or images to the side of the main text.
-@end menu
-
 @node Specified Space
 @subsection Specified Spaces
 @cindex spaces, specified height or width
@@ -3535,25 +3563,28 @@ string.
 @cindex display margins
 @cindex margins, display
 
-  A buffer can have blank areas called @dfn{display margins} on the left
-and on the right.  Ordinary text never appears in these areas, but you
-can put things into the display margins using the @code{display}
-property.
-
-  To put text in the left or right display margin of the window, use a
-display specification of the form @code{(margin right-margin)} or
-@code{(margin left-margin)} on it.  To put an image in a display margin,
-use that display specification along with the display specification for
-the image.  Unfortunately, there is currently no way to make
-text or images in the margin mouse-sensitive.
-
-  If you put such a display specification directly on text in the
-buffer, the specified margin display appears @emph{instead of} that
-buffer text itself.  To put something in the margin @emph{in
-association with} certain buffer text without preventing or altering
-the display of that text, put a @code{before-string} property on the
-text and put the display specification on the contents of the
-before-string.
+  A buffer can have blank areas called @dfn{display margins} on the
+left and on the right.  Ordinary text never appears in these areas,
+but you can put things into the display margins using the
+@code{display} property.  There is currently no way to make text or
+images in the margin mouse-sensitive.
+
+  The way to display something in the margins is to specify it in a
+margin display specification in the @code{display} property of some
+text.  This is a replacing display specification, meaning that the
+text you put it on does not get displayed; the margin display appears,
+but that text does not.
+
+  A margin display specification looks like @code{((margin
+right-margin) @var{spec}} or @code{((margin left-margin) @var{spec})}.
+Here, @var{spec} is another display specification that says what to
+display in the margin.  Typically it is a string of text to display,
+or an image descriptor.
+
+  To display something in the margin @emph{in association with}
+certain buffer text, without altering or preventing the display of
+that text, put a @code{before-string} property on the text and put the
+margin display specification on the contents of the before-string.
 
   Before the display margins can display anything, you must give
 them a nonzero width.  The usual way to do that is to set these