diff options
| author | Richard M. Stallman | 2006-07-05 17:09:30 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-07-05 17:09:30 +0000 |
| commit | d735cf50f7d8af52b44a5b45a8254b221ac73cef (patch) | |
| tree | 2ff8f1a1389df4d353f25a52b8e73f0ca0fd169d | |
| parent | fc0804c44752e4d7bb878ccdb77952dbca07ec79 (diff) | |
| download | emacs-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.texi | 55 |
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 | |||
| 176 | arguments can be given in either order. But most often the smaller | 176 | arguments can be given in either order. But most often the smaller |
| 177 | argument is written first. | 177 | argument is written first. |
| 178 | 178 | ||
| 179 | If the text being copied has any text properties, these are copied into | 179 | Here's an example which assumes Font-Lock mode is not enabled: |
| 180 | the string along with the characters they belong to. @xref{Text | ||
| 181 | Properties}. However, overlays (@pxref{Overlays}) in the buffer and | ||
| 182 | their 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 | |||
| 199 | If the text being copied has any text properties, these are copied into | ||
| 200 | the string along with the characters they belong to. @xref{Text | ||
| 201 | Properties}. However, overlays (@pxref{Overlays}) in the buffer and | ||
| 202 | their properties are ignored, not copied. | ||
| 203 | |||
| 204 | For example, if Font-Lock mode is enabled, you might get results like | ||
| 205 | these: | ||
| 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 | |||
| 2530 | Lists}). The properties belong to a particular character at a | 2542 | Lists}). The properties belong to a particular character at a |
| 2531 | particular place, such as, the letter @samp{T} at the beginning of this | 2543 | particular place, such as, the letter @samp{T} at the beginning of this |
| 2532 | sentence or the first @samp{o} in @samp{foo}---if the same character | 2544 | sentence or the first @samp{o} in @samp{foo}---if the same character |
| 2533 | occurs in two different places, the two occurrences generally have | 2545 | occurs in two different places, the two occurrences in general have |
| 2534 | different properties. | 2546 | different 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 |
| 2537 | object, but the name is normally a symbol. The usual way to access the | 2549 | object, but the name is normally a symbol. Typically each property |
| 2538 | property list is to specify a name and ask what value corresponds to it. | 2550 | name symbol is used for a particular purpose; for instance, the text |
| 2551 | property @code{face} specifies the faces for displaying the character | ||
| 2552 | (@pxref{Special Properties}). The usual way to access the property | ||
| 2553 | list 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 | ||
| 2857 | This is like @code{next-property-change}, but scans back from @var{pos} | ||
| 2858 | instead of forward. If the value is non-@code{nil}, it is a position | ||
| 2859 | less than or equal to @var{pos}; it equals @var{pos} only if @var{limit} | ||
| 2860 | equals @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 |
| 2842 | The function scans the text forward from position @var{pos} in the | 2864 | The function scans text for a change in the @var{prop} property, then |
| 2843 | string or buffer @var{object} till it finds a change in the @var{prop} | 2865 | returns the position of the change. The scan goes forward from |
| 2844 | property, then returns the position of the change. In other words, it | 2866 | position @var{pos} in the string or buffer @var{object}. In other |
| 2845 | returns the position of the first character beyond @var{pos} whose | 2867 | words, this function returns the position of the first character |
| 2846 | @var{prop} property differs from that of the character just after | 2868 | beyond @var{pos} whose @var{prop} property differs from that of the |
| 2847 | @var{pos}. | 2869 | character just after @var{pos}. |
| 2848 | 2870 | ||
| 2849 | If @var{limit} is non-@code{nil}, then the scan ends at position | 2871 | If @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 | |||
| 2856 | equals @var{pos} only if @var{limit} equals @var{pos}. | 2878 | equals @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 | ||
| 2860 | This is like @code{next-property-change}, but scans back from @var{pos} | ||
| 2861 | instead of forward. If the value is non-@code{nil}, it is a position | ||
| 2862 | less than or equal to @var{pos}; it equals @var{pos} only if @var{limit} | ||
| 2863 | equals @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 |
| 2867 | This is like @code{next-single-property-change}, but scans back from | 2882 | This 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 |