Mercurial > emacs
comparison lispref/display.texi @ 78837:5c28c184a1f6
(Display Property): Clarify when multiple display specs work in
parallel and when one overrides. Fix error in example.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 19 Sep 2007 15:04:45 +0000 |
parents | cd4709291938 |
children | d8476ffa81b3 |
comparison
equal
deleted
inserted
replaced
78836:77e62aa4e2b8 | 78837:5c28c184a1f6 |
---|---|
3235 | 3235 |
3236 The @code{display} text property (or overlay property) is used to | 3236 The @code{display} text property (or overlay property) is used to |
3237 insert images into text, and also control other aspects of how text | 3237 insert images into text, and also control other aspects of how text |
3238 displays. The value of the @code{display} property should be a | 3238 displays. The value of the @code{display} property should be a |
3239 display specification, or a list or vector containing several display | 3239 display specification, or a list or vector containing several display |
3240 specifications (which apply in parallel to the text they cover). | 3240 specifications. Display specifications generally apply in parallel to |
3241 | 3241 the text they cover. |
3242 Some kinds of @code{display} properties specify something to display | 3242 |
3243 instead of the text that has the property. In this case, ``the text'' | 3243 Some kinds of @code{display} specifications specify something to |
3244 means all the consecutive characters that have the same Lisp object as | 3244 display instead of the text that has the property. If a list of |
3245 their @code{display} property; these characters are replaced as a | 3245 display specifications includes more than one of this kind, the first |
3246 single unit. By contrast, characters that have similar but distinct | 3246 is effective and the rest are ignored. |
3247 Lisp objects as their @code{display} properties are handled | 3247 |
3248 separately. Here's a function that illustrates this point: | 3248 For these specifications, ``the text that has the property'' means |
3249 all the consecutive characters that have the same Lisp object as their | |
3250 @code{display} property; these characters are replaced as a single | |
3251 unit. By contrast, characters that have similar but distinct Lisp | |
3252 objects as their @code{display} properties are handled separately. | |
3253 Here's a function that illustrates this point: | |
3249 | 3254 |
3250 @smallexample | 3255 @smallexample |
3251 (defun foo () | 3256 (defun foo () |
3252 (goto-char (point-min)) | 3257 (goto-char (point-min)) |
3253 (dotimes (i 5) | 3258 (dotimes (i 5) |
3271 @smallexample | 3276 @smallexample |
3272 (defun foo () | 3277 (defun foo () |
3273 (goto-char (point-min)) | 3278 (goto-char (point-min)) |
3274 (dotimes (i 5) | 3279 (dotimes (i 5) |
3275 (let ((string (concat "A"))) | 3280 (let ((string (concat "A"))) |
3276 (put-text-property (point) (2+ (point)) 'display string) | 3281 (put-text-property (point) (+ 2 (point)) 'display string) |
3277 (put-text-property (point) (1+ (point)) 'display string) | 3282 (put-text-property (point) (1+ (point)) 'display string) |
3278 (forward-char 2)))) | 3283 (forward-char 2)))) |
3279 @end smallexample | 3284 @end smallexample |
3280 | 3285 |
3281 @noindent | 3286 @noindent |