annotate man/lispref/extents.texi @ 5089:99f8ebc082d9

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