annotate man/lispref/extents.texi @ 359:8e84bee8ddd0 r21-1-9

Import from CVS: tag r21-1-9
author cvs
date Mon, 13 Aug 2007 10:57:55 +0200
parents 54f7aa390f4f
children 1d62742628b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 @c -*-texinfo-*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 @c This is part of the XEmacs Lisp Reference Manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 @c Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 @c Copyright (C) 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 @c See the file lispref.texi for copying conditions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 @setfilename ../../info/extents.info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 @node Extents, Specifiers, Abbrevs, top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 @chapter Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 @cindex extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 An @dfn{extent} is a region of text (a start position and an end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 position) that is displayed in a particular face and can have certain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 other properties such as being read-only. Extents can overlap each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 other. XEmacs efficiently handles buffers with large numbers of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 extents in them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 @defun extentp object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 This returns @code{t} if @var{object} is an extent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 * Intro to Extents:: Extents are regions over a buffer or string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 * Creating and Modifying Extents::
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 Basic extent functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 * Extent Endpoints:: Accessing and setting the bounds of an extent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 * Finding Extents:: Determining which extents are in an object.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 * Mapping Over Extents:: More sophisticated functions for extent scanning.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 * Extent Properties:: Extents have built-in and user-definable properties.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 * Detached Extents:: Extents that are not in a buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 * Extent Parents:: Inheriting properties from another extent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 * Duplicable Extents:: Extents can be marked to be copied into strings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 * Extents and Events:: Extents can interact with the keyboard and mouse.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 * Atomic Extents:: Treating a block of text as a single entity.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 @node Intro to Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 @section Introduction to Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 @cindex extent priority
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 @cindex priority of an extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 An extent is a region of text within a buffer or string that has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 certain properties associated with it. The properties of an extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 primarily affect the way the text contained in the extent is displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 Extents can freely overlap each other in a buffer or string. Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 are invisible to functions that merely examine the text of a buffer or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
298
70ad99077275 Import from CVS: tag r21-0b47
cvs
parents: 211
diff changeset
48 @emph{Please note:} An alternative way to add properties to a buffer or
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 string is to use text properties. @xref{Text Properties}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 An extent is logically a Lisp object consisting of a start position,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 an end position, a buffer or string to which these positions refer, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 a property list. As text is inserted into a buffer, the start and end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 positions of the extent are automatically adjusted as necessary to keep
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 the extent referring to the same text in the buffer. If text is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 inserted at the boundary of an extent, the extent's @code{start-open}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 and @code{end-open} properties control whether the text is included as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 part of the extent. If the text bounded by an extent is deleted, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 extent becomes @dfn{detached}; its start and end positions are no longer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 meaningful, but it maintains all its other properties and can later be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 reinserted into a buffer. (None of these considerations apply to strings,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 because text cannot be inserted into or deleted from a string.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 Each extent has a face or list of faces associated with it, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 controls the way in which the text bounded by the extent is displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 If an extent's face is @code{nil} or its properties are partially
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 undefined, the corresponding properties from the default face for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 frame is used. If two or more extents overlap, or if a list of more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 than one face is specified for a particular extent, the corresponding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 faces are merged to determine the text's displayed properties. Every
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 extent has a @dfn{priority} that determines which face takes precedence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 if the faces conflict. (If two extents have the same priority, the one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 that comes later in the display order takes precedence. @xref{Extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 Endpoints, display order}.) Higher-numbered priority values correspond
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 to a higher priority, and priority values can be negative. Every extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 is created with a priority of 0, but this can be changed with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 @code{set-extent-priority}. Within a single extent with a list of faces,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 faces earlier in the list have a higher priority than faces later in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 the list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 Extents can be set to respond specially to key and mouse events within
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 the extent. An extent's @code{keymap} property controls the effect of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 key and mouse strokes within the extent's text, and the @code{mouse-face}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 property controls whether the extent is highlighted when the mouse moves
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 over it. @xref{Extents and Events}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 96
diff changeset
87 An extent can optionally have a @dfn{begin-glyph} or @dfn{end-glyph}
211
78478c60bfcd Import from CVS: tag r20-4b4
cvs
parents: 207
diff changeset
88 associated with it. A begin-glyph or end-glyph is a pixmap or string
78478c60bfcd Import from CVS: tag r20-4b4
cvs
parents: 207
diff changeset
89 that will be displayed either at the start or end of an extent or in the
78478c60bfcd Import from CVS: tag r20-4b4
cvs
parents: 207
diff changeset
90 margin of the line that the start or end of the extent lies in,
78478c60bfcd Import from CVS: tag r20-4b4
cvs
parents: 207
diff changeset
91 depending on the extent's layout policy. Begin-glyphs and end-glyphs
78478c60bfcd Import from CVS: tag r20-4b4
cvs
parents: 207
diff changeset
92 are used to implement annotations, and you should use the annotation API
78478c60bfcd Import from CVS: tag r20-4b4
cvs
parents: 207
diff changeset
93 functions in preference to the lower-level extent functions. For more
78478c60bfcd Import from CVS: tag r20-4b4
cvs
parents: 207
diff changeset
94 information, @xref{Annotations}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 If an extent has its @code{detachable} property set, it will become
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 @dfn{detached} (i.e. no longer in the buffer) when all its text its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 deleted. Otherwise, it will simply shrink down to zero-length and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 sit it the same place in the buffer. By default, the @code{detachable}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 property is set on newly-created extents. @xref{Detached Extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 If an extent has its @code{duplicable} property set, it will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 remembered when a string is created from text bounded by the extent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 When the string is re-inserted into a buffer, the extent will also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 be re-inserted. This mechanism is used in the kill, yank, and undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 commands. @xref{Duplicable Extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 @node Creating and Modifying Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 @section Creating and Modifying Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 @defun make-extent from to &optional object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 This function makes an extent for the range [@var{from}, @var{to}) in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 @var{object} (a buffer or string). @var{object} defaults to the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 buffer. Insertions at point @var{to} will be outside of the extent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 insertions at @var{from} will be inside the extent, causing the extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 to grow (@pxref{Extent Endpoints}). This is the same way that markers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 behave. The extent is initially detached if both @var{from} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 @var{to} are @code{nil}, and in this case @var{object} defaults to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 @code{nil}, meaning the extent is in no buffer or string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (@pxref{Detached Extents}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 @defun delete-extent extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 This function removes @var{extent} from its buffer and destroys it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 This does not modify the buffer's text, only its display properties.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 The extent cannot be used thereafter. To remove an extent in such
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 a way that it can be re-inserted later, use @code{detach-extent}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 @xref{Detached Extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 @defun extent-object extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 This function returns the buffer or string that @var{extent} is in. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 the return value is @code{nil}, this means that the extent is detached;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 however, a detached extent will not necessarily return a value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 @defun extent-live-p extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 This function returns @code{nil} if @var{extent} is deleted, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 @code{t} otherwise.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 @node Extent Endpoints
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 @section Extent Endpoints
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 @cindex extent endpoint
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 @cindex extent start position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 @cindex extent end position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 @cindex zero-length extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 @cindex display order
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 @cindex extent order
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 @cindex order of extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 Every extent has a start position and an end position, and logically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 affects the characters between those positions. Normally the start and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 end positions must both be valid positions in the extent's buffer or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 string. However, both endpoints can be @code{nil}, meaning the extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 is detached. @xref{Detached Extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 Whether the extent overlaps its endpoints is governed by its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 @code{start-open} and @code{end-open} properties. Insertion of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 character at a closed endpoint will expand the extent to include that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 character; insertion at an open endpoint will not. Similarly, functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 such as @code{extent-at} that scan over all extents overlapping a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 particular position will include extents with a closed endpoint at that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 position, but not extents with an open endpoint.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 Note that the @code{start-closed} and @code{end-closed} properties are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 equivalent to @code{start-open} and @code{end-open} with the opposite
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 sense.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 Both endpoints can be equal, in which case the extent includes no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 characters but still exists in the buffer or string. Zero-length
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 extents are used to represent annotations (@pxref{Annotations}) and can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 be used as a more powerful form of a marker. Deletion of all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 characters in an extent may or may not result in a zero-length extent;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 this depends on the @code{detachable} property (@pxref{Detached
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 Extents}). Insertion at the position of a zero-length extent expands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 the extent if both endpoints are closed; goes before the extent if it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 has the @code{start-open} property; and goes after the extent if it has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 the @code{end-open} property. Zero-length extents with both the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 @code{start-open} and @code{end-open} properties are treated as if their
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 starting point were closed. Deletion of a character on a side of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 zero-length extent whose corresponding endpoint is closed causes the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 extent to be detached if its @code{detachable} property is set; if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 corresponding endpoint is open, the extent remains in the buffer, moving
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 as necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 Extents are ordered within a buffer or string by increasing start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 position, and then by decreasing end position (this is called the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 @dfn{display order}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 @defun extent-start-position extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 This function returns the start position of @var{extent}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 @defun extent-end-position extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 This function returns the end position of @var{extent}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 @defun extent-length extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 This function returns the length of @var{extent} in characters. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 the extent is detached, this returns @code{0}. If the extent is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 detached, this is equivalent to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (- (extent-end-position @var{extent}) (extent-start-position @var{extent}))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 @defun set-extent-endpoints extent start end &optional buffer-or-string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 This function sets the start and end position of @var{extent} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 @var{start} and @var{end}. If both are @code{nil}, this is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 to @code{detach-extent}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 @var{buffer-or-string} specifies the new buffer or string that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 extent should be in, and defaults to @var{extent}'s buffer or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 string. (If @code{nil}, and @var{extent} is in no buffer and no string,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 it defaults to the current buffer.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 See documentation on @code{detach-extent} for a discussion of undo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 recording.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 @node Finding Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 @section Finding Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 @cindex extents, locating
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 The following functions provide a simple way of determining the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 extents in a buffer or string. A number of more sophisticated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 primitives for mapping over the extents in a range of a buffer or string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 are also provided (@pxref{Mapping Over Extents}). When reading through
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 this section, keep in mind the way that extents are ordered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (@pxref{Extent Endpoints}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 @defun extent-list &optional buffer-or-string from to flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 This function returns a list of the extents in @var{buffer-or-string}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 @var{buffer-or-string} defaults to the current buffer if omitted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 @var{from} and @var{to} can be used to limit the range over which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 extents are returned; if omitted, all extents in the buffer or string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 are returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 More specifically, if a range is specified using @var{from} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 @var{to}, only extents that overlap the range (i.e. begin or end inside
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 of the range) are included in the list. @var{from} and @var{to} default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 to the beginning and end of @var{buffer-or-string}, respectively.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 @var{flags} controls how end cases are treated. For a discussion of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 this, and exactly what ``overlap'' means, see @code{map-extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 Functions that create extents must be prepared for the possibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 that there are other extents in the same area, created by other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 functions. To deal with this, functions typically mark their own
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 extents by setting a particular property on them. The following
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 function makes it easier to locate those extents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 @defun extent-at pos &optional object property before at-flag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 This function finds the ``smallest'' extent (i.e., the last one in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 display order) at (i.e., overlapping) @var{pos} in @var{object} (a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 buffer or string) having @var{property} set. @var{object} defaults to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 the current buffer. @var{property} defaults to @code{nil}, meaning that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 any extent will do. Returns @code{nil} if there is no matching extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 at @var{pos}. If the fourth argument @var{before} is not @code{nil}, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 must be an extent; any returned extent will precede that extent. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 feature allows @code{extent-at} to be used by a loop over extents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 @var{at-flag} controls how end cases are handled (i.e. what ``at''
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 really means), and should be one of:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 @item nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 @item after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 An extent is at @var{pos} if it covers the character after @var{pos}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 This is consistent with the way that text properties work.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 @item before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 An extent is at @var{pos} if it covers the character before @var{pos}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 @item at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 An extent is at @var{pos} if it overlaps or abuts @var{pos}. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 includes all zero-length extents at @var{pos}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 Note that in all cases, the start-openness and end-openness of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 extents considered is ignored. If you want to pay attention to those
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 properties, you should use @code{map-extents}, which gives you more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 control.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 The following low-level functions are provided for explicitly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 traversing the extents in a buffer according to the display order.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 These functions are mostly intended for debugging -- in normal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 operation, you should probably use @code{mapcar-extents} or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 @code{map-extents}, or loop using the @var{before} argument to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 @code{extent-at}, rather than creating a loop using @code{next-extent}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 @defun next-extent extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 Given an extent @var{extent}, this function returns the next extent in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 the buffer or string's display order. If @var{extent} is a buffer or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 string, this returns the first extent in the buffer or string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 @defun previous-extent extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 Given an extent @var{extent}, this function returns the previous extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 in the buffer or string's display order. If @var{extent} is a buffer or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 string, this returns the last extent in the buffer or string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 @node Mapping Over Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 @section Mapping Over Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 @cindex extents, mapping
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 The most basic and general function for mapping over extents is called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 @code{map-extents}. You should read through the definition of this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 function to familiarize yourself with the concepts and optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 arguments involved. However, in practice you may find it more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 convenient to use the function @code{mapcar-extents} or to create a loop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 using the @code{before} argument to @code{extent-at} (@pxref{Finding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 Extents}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 @defun map-extents function &optional object from to maparg flags property value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 This function maps @var{function} over the extents which overlap a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 region in @var{object}. @var{object} is normally a buffer or string but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 could be an extent (see below). The region is normally bounded by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 [@var{from}, @var{to}) (i.e. the beginning of the region is closed and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 the end of the region is open), but this can be changed with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 @var{flags} argument (see below for a complete discussion).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 @var{function} is called with the arguments (extent, @var{maparg}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 The arguments @var{object}, @var{from}, @var{to}, @var{maparg}, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 @var{flags} are all optional and default to the current buffer, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 beginning of @var{object}, the end of @var{object}, @var{nil}, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 @var{nil}, respectively. @code{map-extents} returns the first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 non-@code{nil} result produced by @var{function}, and no more calls to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 @var{function} are made after it returns non-@code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 If @var{object} is an extent, @var{from} and @var{to} default to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 extent's endpoints, and the mapping omits that extent and its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 predecessors. This feature supports restarting a loop based on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 @code{map-extents}. Note: @var{object} must be attached to a buffer or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 string, and the mapping is done over that buffer or string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 An extent overlaps the region if there is any point in the extent that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 is also in the region. (For the purpose of overlap, zero-length extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 and regions are treated as closed on both ends regardless of their
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 endpoints' specified open/closedness.) Note that the endpoints of an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 extent or region are considered to be in that extent or region if and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 only if the corresponding end is closed. For example, the extent [5,7]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 overlaps the region [2,5] because 5 is in both the extent and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 region. However, (5,7] does not overlap [2,5] because 5 is not in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 extent, and neither [5,7] nor (5,7] overlaps the region [2,5) because 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 is not in the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 The optional @var{flags} can be a symbol or a list of one or more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 symbols, modifying the behavior of @code{map-extents}. Allowed symbols
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 @item end-closed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 The region's end is closed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 @item start-open
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 The region's start is open.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 @item all-extents-closed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 Treat all extents as closed on both ends for the purpose of determining
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 whether they overlap the region, irrespective of their actual open- or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 closedness.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 @item all-extents-open
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 Treat all extents as open on both ends.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 @item all-extents-closed-open
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 Treat all extents as start-closed, end-open.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 @item all-extents-open-closed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 Treat all extents as start-open, end-closed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 @item start-in-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 In addition to the above conditions for extent overlap, the extent's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 start position must lie within the specified region. Note that, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 this condition, open start positions are treated as if 0.5 was added to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 the endpoint's value, and open end positions are treated as if 0.5 was
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 subtracted from the endpoint's value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 @item end-in-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 The extent's end position must lie within the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 @item start-and-end-in-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 Both the extent's start and end positions must lie within the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 @item start-or-end-in-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 Either the extent's start or end position must lie within the region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 @item negate-in-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 The condition specified by a @code{*-in-region} flag must @emph{not}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 hold for the extent to be considered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 At most one of @code{all-extents-closed}, @code{all-extents-open},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 @code{all-extents-closed-open}, and @code{all-extents-open-closed} may
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 be specified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 At most one of @code{start-in-region}, @code{end-in-region},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 @code{start-and-end-in-region}, and @code{start-or-end-in-region} may be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 specified.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 If optional arg @var{property} is non-@code{nil}, only extents with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 that property set on them will be visited. If optional arg @var{value}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 is non-@code{nil}, only extents whose value for that property is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 @code{eq} to @var{value} will be visited.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 If you want to map over extents and accumulate a list of results,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 the following function may be more convenient than @code{map-extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 @defun mapcar-extents function &optional predicate buffer-or-string from to flags property value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 This function applies @var{function} to all extents which overlap a
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
410 region in @var{buffer-or-string}. The region is delimited by
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 @var{from} and @var{to}. @var{function} is called with one argument,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 the extent. A list of the values returned by @var{function} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 returned. An optional @var{predicate} may be used to further limit the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 extents over which @var{function} is mapped. The optional arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 @var{flags}, @var{property}, and @var{value} may also be used to control
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 the extents passed to @var{predicate} or @var{function}, and have the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 same meaning as in @code{map-extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 @defun map-extent-children function &optional object from to maparg flags property value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 This function is similar to @code{map-extents}, but differs in that:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 It only visits extents which start in the given region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 After visiting an extent @var{e}, it skips all other extents which start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 inside @var{e} but end before @var{e}'s end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 Thus, this function may be used to walk a tree of extents in a buffer:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (defun walk-extents (buffer &optional ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (map-extent-children 'walk-extents buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 @defun extent-in-region-p extent &optional from to flags
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 This function returns @var{t} if @code{map-extents} would visit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 @var{extent} if called with the given arguments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 @node Extent Properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 @section Properties of Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 @cindex extent property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 @cindex property of an extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 Each extent has a property list associating property names with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 values. Some property names have predefined meanings, and can usually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 only assume particular values. Assigning other values to such a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 property either cause the value to be converted into a legal value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (e.g., assigning anything but @code{nil} to a Boolean property will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 cause the value of @code{t} to be assigned to the property) or will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 cause an error. Property names without predefined meanings can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 assigned any value. An undefined property is equivalent to a property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 with a value of @code{nil}, or with a particular default value in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 case of properties with predefined meanings. Note that, when an extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 is created, the @code{end-open} and @code{detachable} properties are set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 on it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 If an extent has a parent, all of its properties actually derive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 from that parent (or from the root ancestor if the parent in turn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 has a parent), and setting a property of the extent actually sets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 that property on the parent. @xref{Extent Parents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 @defun extent-property extent property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 This function returns the value of @var{property} in @var{extent}. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 @var{property} is undefined, @code{nil} is returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 @defun extent-properties extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 This function returns a list of all of @var{extent}'s properties that do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 not have the value of @code{nil} (or the default value, for properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 with predefined meanings).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 @defun set-extent-property extent property value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 This function sets @var{property} to @var{value} in @var{extent}. (If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 @var{property} has a predefined meaning, only certain values are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 allowed, and some values may be converted to others before being
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 stored.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
484 @defun set-extent-properties extent plist
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
485 Change some properties of @var{extent}. @var{plist} is a property
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
486 list. This is useful to change many extent properties at once.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
487 @end defun
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
488
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 The following table lists the properties with predefined meanings, along
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 with their allowable values.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 @item detached
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (Boolean) Whether the extent is detached. Setting this is the same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 as calling @code{detach-extent}. @xref{Detached Extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 @item destroyed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 (Boolean) Whether the extent has been deleted. Setting this is the same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 as calling @code{delete-extent}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 @item priority
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (integer) The extent's redisplay priority. Defaults to 0. @xref{Intro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 to Extents, priority}. This property can also be set with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 @code{set-extent-priority} and accessed with @code{extent-priority}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 @item start-open
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (Boolean) Whether the start position of the extent is open, meaning that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 characters inserted at that position go outside of the extent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 @xref{Extent Endpoints}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 @item start-closed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (Boolean) Same as @code{start-open} but with the opposite sense. Setting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 this property clears @code{start-open} and vice-versa.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 @item end-open
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (Boolean) Whether the end position of the extent is open, meaning that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 characters inserted at that position go outside of the extent. This is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 @code{t} by default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 @xref{Extent Endpoints}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 @item end-closed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (Boolean) Same as @code{end-open} but with the opposite sense. Setting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 this property clears @code{end-open} and vice-versa.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 @item read-only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (Boolean) Whether text within this extent will be unmodifiable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 @item face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (face, face name, list of faces or face names, or @code{nil}) The face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 in which to display the extent's text. This property can also be set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 with @code{set-extent-face} and accessed with @code{extent-face}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 Note that if a list of faces is specified, the faces are merged together,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 with faces earlier in the list having priority over faces later in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 @item mouse-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (face, face name, list of faces or face names, or @code{nil}) The face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 used to display the extent when the mouse moves over it. This property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 can also be set with @code{set-extent-mouse-face} and accessed with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 @code{extent-mouse-face}. Note that if a list of faces is specified,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 the faces are merged together, with faces earlier in the list having
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 priority over faces later in the list. @xref{Extents and Events}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 @item pointer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (pointer glyph) The glyph used as the pointer when the mouse moves over
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 the extent. This takes precedence over the @code{text-pointer-glyph}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 and @code{nontext-pointer-glyph} variables. If for any reason this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 glyph is an invalid pointer, the standard glyphs will be used as
335
54f7aa390f4f Import from CVS: tag r21-0-65
cvs
parents: 298
diff changeset
549 fallbacks. @xref{Mouse Pointer}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 @item detachable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (Boolean) Whether this extent becomes detached when all of the text it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 covers is deleted. This is @code{t} by default. @xref{Detached
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 Extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 @item duplicable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (Boolean) Whether this extent should be copied into strings, so that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 kill, yank, and undo commands will restore or copy it. @xref{Duplicable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 Extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 @item unique
96
dbb370e3c29e Import from CVS: tag r20-0final
cvs
parents: 70
diff changeset
562 (Boolean) Meaningful only in conjunction with @code{duplicable}.
dbb370e3c29e Import from CVS: tag r20-0final
cvs
parents: 70
diff changeset
563 When this is set, there may be only one instance of
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 this extent attached at a time. @xref{Duplicable Extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 @item invisible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (Boolean) If @code{t}, text under this extent will not be displayed --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 it will look as if the text is not there at all.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 @item keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (keymap or @code{nil}) This keymap is consulted for mouse clicks on this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 extent or keypresses made while @code{point} is within the extent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 @xref{Extents and Events}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 @item copy-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 This is a hook that is run when a duplicable extent is about to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 copied from a buffer to a string (or the kill ring). @xref{Duplicable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 Extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 @item paste-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 This is a hook that is run when a duplicable extent is about to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 copied from a string (or the kill ring) into a buffer. @xref{Duplicable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 Extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 @item begin-glyph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (glyph or @code{nil}) This extent's begin glyph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 @xref{Annotations}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 @item end-glyph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (glyph or @code{nil}) This extent's end glyph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 @xref{Annotations}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 @item begin-glyph-layout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (@code{text}, @code{whitespace}, @code{inside-margin}, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 @code{outside-margin}) The layout policy for this extent's begin glyph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 Defaults to @code{text}. @xref{Annotations}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 @item end-glyph-layout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (@code{text}, @code{whitespace}, @code{inside-margin}, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 @code{outside-margin}) The layout policy for this extent's end glyph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 Defaults to @code{text}. @xref{Annotations}.
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
602
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
603 @item initial-redisplay-function
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
604 (any funcallable object) The function to be called the first time (a
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
605 part of) the extent is redisplayed. It will be called with the extent
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
606 as its argument.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
607
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
608 This is used by @code{lazy-shot} to implement lazy font-locking. The
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
609 functionality is still experimental, and may change without further
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
610 notice.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 The following convenience functions are provided for accessing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 particular properties of an extent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 @defun extent-face extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 This function returns the @code{face} property of @var{extent}. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 might also return a list of face names. Do not modify this list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 directly! Instead, use @code{set-extent-face}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 Note that you can use @code{eq} to compare lists of faces as returned
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 by @code{extent-face}. In other words, if you set the face of two
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 different extents to two lists that are @code{equal} but not @code{eq},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 then the return value of @code{extent-face} on the two extents will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 return the identical list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 @defun extent-mouse-face extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 This function returns the @code{mouse-face} property of @var{extent}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 This might also return a list of face names. Do not modify this list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 directly! Instead, use @code{set-extent-mouse-face}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 Note that you can use @code{eq} to compare lists of faces as returned
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 by @code{extent-mouse-face}, just like for @code{extent-face}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 @defun extent-priority extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 This function returns the @code{priority} property of @var{extent}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640
211
78478c60bfcd Import from CVS: tag r20-4b4
cvs
parents: 207
diff changeset
641 @defun extent-keymap extent
78478c60bfcd Import from CVS: tag r20-4b4
cvs
parents: 207
diff changeset
642 This function returns the @code{keymap} property of @var{extent}.
78478c60bfcd Import from CVS: tag r20-4b4
cvs
parents: 207
diff changeset
643 @end defun
78478c60bfcd Import from CVS: tag r20-4b4
cvs
parents: 207
diff changeset
644
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 @defun extent-begin-glyph-layout extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 This function returns the @code{begin-glyph-layout} property of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 @var{extent}, i.e. the layout policy associated with the @var{extent}'s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 begin glyph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 @defun extent-end-glyph-layout extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 This function returns the @code{end-glyph-layout} property of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 @var{extent}, i.e. the layout policy associated with the @var{extent}'s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 end glyph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 @defun extent-begin-glyph extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 This function returns the @code{begin-glyph} property of @var{extent},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 i.e. the glyph object displayed at the beginning of @var{extent}. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 there is none, @code{nil} is returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 @defun extent-end-glyph extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 This function returns the @code{end-glyph} property of @var{extent},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 i.e. the glyph object displayed at the end of @var{extent}. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 there is none, @code{nil} is returned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 The following convenience functions are provided for setting particular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 properties of an extent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 @defun set-extent-priority extent pri
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 This function sets the @code{priority} property of @var{extent} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 @var{pri}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 @defun set-extent-face extent face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 This function sets the @code{face} property of @var{extent} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 @var{face}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 @defun set-extent-mouse-face extent face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 This function sets the @code{mouse-face} property of @var{extent} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 @var{face}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 @defun set-extent-keymap extent keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 This function sets the @code{keymap} property of @var{extent} to
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
689 @var{keymap}. @var{keymap} must be either a keymap object, or
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
690 @code{nil}.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 @defun set-extent-begin-glyph-layout extent layout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 This function sets the @code{begin-glyph-layout} property of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 @var{extent} to @var{layout}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 @defun set-extent-end-glyph-layout extent layout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 This function sets the @code{end-glyph-layout} property of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 @var{extent} to @var{layout}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 @defun set-extent-begin-glyph extent begin-glyph &optional layout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 This function sets the @code{begin-glyph} and @code{glyph-layout}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 properties of @var{extent} to @var{begin-glyph} and @var{layout},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 respectively. (@var{layout} defaults to @code{text} if not specified.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 @defun set-extent-end-glyph extent end-glyph &optional layout
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 This function sets the @code{end-glyph} and @code{glyph-layout}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 properties of @var{extent} to @var{end-glyph} and @var{layout},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 respectively. (@var{layout} defaults to @code{text} if not specified.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
715 @defun set-extent-initial-redisplay-function extent function
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
716 This function sets the @code{initial-redisplay-function} property of the
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
717 extent to @var{function}.
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
718 @end defun
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 98
diff changeset
719
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 @node Detached Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 @section Detached Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 @cindex detached extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 A detached extent is an extent that is not attached to a buffer or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 string but can be re-inserted. Detached extents have a start position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 and end position of @code{nil}. Extents can be explicitly detached
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 using @code{detach-extent}. An extent is also detached when all of its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 characters are all killed by a deletion, if its @code{detachable}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 property is set; if this property is not set, the extent becomes a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 zero-length extent. (Zero-length extents with the @code{detachable}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 property set behave specially. @xref{Extent Endpoints, zero-length
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 extents}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 @defun detach-extent extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 This function detaches @var{extent} from its buffer or string. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 @var{extent} has the @code{duplicable} property, its detachment is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 tracked by the undo mechanism. @xref{Duplicable Extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 @defun extent-detached-p extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 This function returns @code{nil} if @var{extent} is detached, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 @code{t} otherwise.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 @defun copy-extent extent &optional object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 This function makes a copy of @var{extent}. It is initially detached.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 Optional argument @var{object} defaults to @var{extent}'s object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 (normally a buffer or string, but could be @code{nil}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 @defun insert-extent extent &optional start end no-hooks object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 This function inserts @var{extent} from @var{start} to @var{end} in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 @var{object} (a buffer or string). If @var{extent} is detached from a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 different buffer or string, or in most cases when @var{extent} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 already attached, the extent will first be copied as if with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 @code{copy-extent}. This function operates the same as if @code{insert}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 were called on a string whose extent data calls for @var{extent} to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 inserted, except that if @var{no-hooks} is non-@code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 @var{extent}'s @code{paste-function} will not be invoked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 @xref{Duplicable Extents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 @node Extent Parents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 @section Extent Parents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 @cindex extent parent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 @cindex extent children
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 @cindex parent, of extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 @cindex children, of extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 An extent can have a parent extent set for it. If this is the case,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 the extent derives all its properties from that extent and has no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 properties of its own. The only ``properties'' that the extent keeps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 are the buffer or string it refers to and the start and end points.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 (More correctly, the extent's own properties are shadowed. If you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 later change the extent to have no parent, its own properties will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 become visible again.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 It is possible for an extent's parent to itself have a parent,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 and so on. Through this, a whole tree of extents can be created,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 all deriving their properties from one root extent. Note, however,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 that you cannot create an inheritance loop -- this is explicitly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 disallowed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783
96
dbb370e3c29e Import from CVS: tag r20-0final
cvs
parents: 70
diff changeset
784 Parent extents are used to implement the extents over the modeline.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 @defun set-extent-parent extent parent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 This function sets the parent of @var{extent} to @var{parent}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 If @var{parent} is @code{nil}, the extent is set to have no parent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 @defun extent-parent extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 This function return the parents (if any) of @var{extent}, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 @defun extent-children extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 This function returns a list of the children (if any) of @var{extent}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 The children of an extent are all those extents whose parent is that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 extent. This function does not recursively trace children of children.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 @defun extent-descendants extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 This function returns a list of all descendants of @var{extent},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 including @var{extent}. This recursively applies @code{extent-children}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 to any children of @var{extent}, until no more children can be found.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 @node Duplicable Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 @section Duplicable Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 @cindex duplicable extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 @cindex unique extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 @cindex extent replica
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 @cindex extent, duplicable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 @cindex extent, unique
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 If an extent has the @code{duplicable} property, it will be copied into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 strings, so that kill, yank, and undo commands will restore or copy it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 Specifically:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 When a string is created using @code{buffer-substring} or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 @code{buffer-string}, any duplicable extents in the region corresponding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 to the string will be copied into the string (@pxref{Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 Contents}). When the string in inserted into a buffer using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 @code{insert}, @code{insert-before-markers}, @code{insert-buffer} or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 @code{insert-buffer-substring}, the extents in the string will be copied
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 back into the buffer (@pxref{Insertion}). The extents in a string can,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830 of course, be retrieved explicitly using the standard extent primitives
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 over the string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 Similarly, when text is copied or cut into the kill ring, any duplicable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 extents will be remembered and reinserted later when the text is pasted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 back into a buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 When @code{concat} is called on strings, the extents in the strings are
96
dbb370e3c29e Import from CVS: tag r20-0final
cvs
parents: 70
diff changeset
840 copied into the resulting string.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 When @code{substring} is called on a string, the relevant extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 are copied into the resulting string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 When a duplicable extent is detached by @code{detach-extent} or string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 deletion, or inserted by @code{insert-extent} or string insertion, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 action is recorded by the undo mechanism so that it can be undone later.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 Note that if an extent gets detached and then a later undo causes the
96
dbb370e3c29e Import from CVS: tag r20-0final
cvs
parents: 70
diff changeset
851 extent to get reinserted, the new extent will not be `eq' to the original
dbb370e3c29e Import from CVS: tag r20-0final
cvs
parents: 70
diff changeset
852 extent.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 Extent motion, face changes, and attachment via @code{make-extent} are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 not recorded by the undo mechanism. This means that extent changes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 which are to be undo-able must be performed by character editing, or by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 insertion and detachment of duplicable extents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 A duplicable extent's @code{copy-function} property, if non-@code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 should be a function, and will be run when a duplicable extent is about
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 to be copied from a buffer to a string (or the kill ring). It is called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 with three arguments: the extent and the buffer positions within it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 which are being copied. If this function returns @code{nil}, then the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 extent will not be copied; otherwise it will.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 A duplicable extent's @code{paste-function} property, if non-@code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 should be a function, and will be run when a duplicable extent is about
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 to be copied from a string (or the kill ring) into a buffer. It is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 called with three arguments: the original extent and the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 positions which the copied extent will occupy. (This hook is run after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 the corresponding text has already been inserted into the buffer.) Note
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 that the extent argument may be detached when this function is run. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 this function returns @code{nil}, no extent will be inserted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 Otherwise, there will be an extent covering the range in question.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 Note: if the extent to be copied is already attached to the buffer and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 overlaps the new range, the extent will simply be extended and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 @code{paste-function} will not be called.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 @node Extents and Events
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 @section Interaction of Extents with Keyboard and Mouse Events
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 If an extent has the @code{mouse-face} property set, it will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 highlighted when the mouse passes over it. Highlighting is accomplished
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 by merging the extent's face with the face or faces specified by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 @code{mouse-face} property. The effect is as if a pseudo-extent with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 the @code{mouse-face} face were inserted after the extent in the display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 order (@pxref{Extent Endpoints}, display order).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 @defvar mouse-highlight-priority
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 This variable holds the priority to use when merging in the highlighting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 pseudo-extent. The default is 1000. This is purposely set very high
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 so that the highlighting pseudo-extent shows up even if there are other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 extents with various priorities at the same location.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 You can also explicitly cause an extent to be highlighted. Only one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 extent at a time can be highlighted in this fashion, and any other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 highlighted extent will be de-highlighted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 @defun highlight-extent extent &optional highlight-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 This function highlights (if @var{highlight-p} is non-@code{nil}) or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 de-highlights (if @var{highlight-p} is @code{nil}) @var{extent}, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 @var{extent} has the @code{mouse-face} property. (Nothing happens if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 @var{extent} does not have the @code{mouse-face} property.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 @defun force-highlight-extent extent &optional highlight-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 This function is similar to @code{highlight-extent} but highlights
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 or de-highlights the extent regardless of whether it has the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 @code{mouse-face} property.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 If an extent has a @code{keymap} property, this keymap will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 consulted for mouse clicks on the extent and keypresses made while
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 @code{point} is within the extent. The behavior of mouse clicks and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 keystrokes not defined in the keymap is as normal for the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 @node Atomic Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 @section Atomic Extents
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 @cindex atomic extent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 If the Lisp file @file{atomic-extents} is loaded, then the atomic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 extent facility is available. An @dfn{atomic extent} is an extent for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 which @code{point} cannot be positioned anywhere within it. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 ensures that when selecting text, either all or none of the extent is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 selected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 To make an extent atomic, set its @code{atomic} property.