aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2006-07-05 17:09:30 +0000
committerRichard M. Stallman2006-07-05 17:09:30 +0000
commitd735cf50f7d8af52b44a5b45a8254b221ac73cef (patch)
tree2ff8f1a1389df4d353f25a52b8e73f0ca0fd169d
parentfc0804c44752e4d7bb878ccdb77952dbca07ec79 (diff)
downloademacs-d735cf50f7d8af52b44a5b45a8254b221ac73cef.tar.gz
emacs-d735cf50f7d8af52b44a5b45a8254b221ac73cef.zip
(Buffer Contents): Add example of text props in result of buffer-substring.
(Text Properties): Explain better about use of specific property names. (Property Search): Some cleanups; reorder some functions.
-rw-r--r--lispref/text.texi55
1 files changed, 35 insertions, 20 deletions
diff --git a/lispref/text.texi b/lispref/text.texi
index 802c69145c5..6c295627ced 100644
--- a/lispref/text.texi
+++ b/lispref/text.texi
@@ -176,10 +176,7 @@ It is not necessary for @var{start} to be less than @var{end}; the
176arguments can be given in either order. But most often the smaller 176arguments can be given in either order. But most often the smaller
177argument is written first. 177argument is written first.
178 178
179If the text being copied has any text properties, these are copied into 179Here's an example which assumes Font-Lock mode is not enabled:
180the string along with the characters they belong to. @xref{Text
181Properties}. However, overlays (@pxref{Overlays}) in the buffer and
182their properties are ignored, not copied.
183 180
184@example 181@example
185@group 182@group
@@ -198,6 +195,21 @@ This is the contents of buffer foo
198 @result{} "he contents of buffer foo\n" 195 @result{} "he contents of buffer foo\n"
199@end group 196@end group
200@end example 197@end example
198
199If the text being copied has any text properties, these are copied into
200the string along with the characters they belong to. @xref{Text
201Properties}. However, overlays (@pxref{Overlays}) in the buffer and
202their properties are ignored, not copied.
203
204For example, if Font-Lock mode is enabled, you might get results like
205these:
206
207@example
208@group
209(buffer-substring 1 10)
210 @result{} #("This is t" 0 1 (fontified t) 1 9 (fontified t))
211@end group
212@end example
201@end defun 213@end defun
202 214
203@defun buffer-substring-no-properties start end 215@defun buffer-substring-no-properties start end
@@ -2530,12 +2542,15 @@ property list}, much like the property list of a symbol (@pxref{Property
2530Lists}). The properties belong to a particular character at a 2542Lists}). The properties belong to a particular character at a
2531particular place, such as, the letter @samp{T} at the beginning of this 2543particular place, such as, the letter @samp{T} at the beginning of this
2532sentence or the first @samp{o} in @samp{foo}---if the same character 2544sentence or the first @samp{o} in @samp{foo}---if the same character
2533occurs in two different places, the two occurrences generally have 2545occurs in two different places, the two occurrences in general have
2534different properties. 2546different properties.
2535 2547
2536 Each property has a name and a value. Both of these can be any Lisp 2548 Each property has a name and a value. Both of these can be any Lisp
2537object, but the name is normally a symbol. The usual way to access the 2549object, but the name is normally a symbol. Typically each property
2538property list is to specify a name and ask what value corresponds to it. 2550name symbol is used for a particular purpose; for instance, the text
2551property @code{face} specifies the faces for displaying the character
2552(@pxref{Special Properties}). The usual way to access the property
2553list is to specify a name and ask what value corresponds to it.
2539 2554
2540 If a character has a @code{category} property, we call it the 2555 If a character has a @code{category} property, we call it the
2541@dfn{category} of the character. It should be a symbol. The properties 2556@dfn{category} of the character. It should be a symbol. The properties
@@ -2838,13 +2853,20 @@ which all properties are constant:
2838@end smallexample 2853@end smallexample
2839@end defun 2854@end defun
2840 2855
2856@defun previous-property-change pos &optional object limit
2857This is like @code{next-property-change}, but scans back from @var{pos}
2858instead of forward. If the value is non-@code{nil}, it is a position
2859less than or equal to @var{pos}; it equals @var{pos} only if @var{limit}
2860equals @var{pos}.
2861@end defun
2862
2841@defun next-single-property-change pos prop &optional object limit 2863@defun next-single-property-change pos prop &optional object limit
2842The function scans the text forward from position @var{pos} in the 2864The function scans text for a change in the @var{prop} property, then
2843string or buffer @var{object} till it finds a change in the @var{prop} 2865returns the position of the change. The scan goes forward from
2844property, then returns the position of the change. In other words, it 2866position @var{pos} in the string or buffer @var{object}. In other
2845returns the position of the first character beyond @var{pos} whose 2867words, this function returns the position of the first character
2846@var{prop} property differs from that of the character just after 2868beyond @var{pos} whose @var{prop} property differs from that of the
2847@var{pos}. 2869character just after @var{pos}.
2848 2870
2849If @var{limit} is non-@code{nil}, then the scan ends at position 2871If @var{limit} is non-@code{nil}, then the scan ends at position
2850@var{limit}. If there is no property change before that point, 2872@var{limit}. If there is no property change before that point,
@@ -2856,13 +2878,6 @@ non-@code{nil}, it is a position greater than or equal to @var{pos}; it
2856equals @var{pos} only if @var{limit} equals @var{pos}. 2878equals @var{pos} only if @var{limit} equals @var{pos}.
2857@end defun 2879@end defun
2858 2880
2859@defun previous-property-change pos &optional object limit
2860This is like @code{next-property-change}, but scans back from @var{pos}
2861instead of forward. If the value is non-@code{nil}, it is a position
2862less than or equal to @var{pos}; it equals @var{pos} only if @var{limit}
2863equals @var{pos}.
2864@end defun
2865
2866@defun previous-single-property-change pos prop &optional object limit 2881@defun previous-single-property-change pos prop &optional object limit
2867This is like @code{next-single-property-change}, but scans back from 2882This is like @code{next-single-property-change}, but scans back from
2868@var{pos} instead of forward. If the value is non-@code{nil}, it is a 2883@var{pos} instead of forward. If the value is non-@code{nil}, it is a