aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-03-17 23:19:40 +0000
committerRichard M. Stallman2005-03-17 23:19:40 +0000
commit4db6da64fbd2fbc57322e00141dd9ed22eeb7fde (patch)
treefc845b0ffefd682560cdd9c2c7c00f56a706e117
parent9644814c81171f500482df6c4f02d110c9cc94fb (diff)
downloademacs-4db6da64fbd2fbc57322e00141dd9ed22eeb7fde.tar.gz
emacs-4db6da64fbd2fbc57322e00141dd9ed22eeb7fde.zip
(Display Property): Explain the significance
of having text properties that are eq. (Other Display Specs): Explain string as display spec.
-rw-r--r--lispref/display.texi53
1 files changed, 52 insertions, 1 deletions
diff --git a/lispref/display.texi b/lispref/display.texi
index 43329f35ced..1b25c924420 100644
--- a/lispref/display.texi
+++ b/lispref/display.texi
@@ -3064,7 +3064,55 @@ buffer. The default is to use the @code{arrow} (non-text) pointer.
3064insert images into text, and also control other aspects of how text 3064insert images into text, and also control other aspects of how text
3065displays. The value of the @code{display} property should be a 3065displays. The value of the @code{display} property should be a
3066display specification, or a list or vector containing several display 3066display specification, or a list or vector containing several display
3067specifications. The rest of this section describes several kinds of 3067specifications.
3068
3069 Some kinds of @code{display} properties specify something to display
3070instead of the text that has the property. In this case, ``the text''
3071means all the consecutive characters that have the same Lisp object as
3072their @code{display} property; these characters are replaced as a
3073single unit. By contrast, characters that have similar but distinct
3074Lisp objects as their @code{display} properties are handled
3075separately. Here's a function that illustrates this point:
3076
3077@example
3078(defun foo ()
3079 (goto-char (point-min))
3080 (dotimes (i 5)
3081 (let ((string (concat "A")))
3082 (put-text-property (point) (1+ (point)) 'display string)
3083 (forward-char 1)
3084 (put-text-property (point) (1+ (point)) 'display string)
3085 (forward-char 1))))
3086@end example
3087
3088@noindent
3089It gives each of the first ten characters in the buffer string
3090@code{"A"} as the @code{display} property, but they don't all get the
3091same string. The first two characters get the same string, so they
3092together are replaced with one @samp{A}. The next two characters get
3093a second string, so they together are replaced with one @samp{A}.
3094Likewise for each following pair of characters. Thus, the ten
3095characters appear as five A's. This function would have the same
3096results:
3097
3098@example
3099(defun foo ()
3100 (goto-char (point-min))
3101 (dotimes (i 5)
3102 (let ((string (concat "A")))
3103 (put-text-property (point) (2+ (point)) 'display string)
3104 (put-text-property (point) (1+ (point)) 'display string)
3105 (forward-char 2))))
3106@end example
3107
3108@noindent
3109This illustrates that what matters is the property value for
3110each character. If two consecutive characters have the same
3111object as the @code{display} property value, it's irrelevent
3112whether they got this property from a single call to
3113@code{put-text-property} or from two different calls.
3114
3115 The rest of this section describes several kinds of
3068display specifications and what they mean. 3116display specifications and what they mean.
3069 3117
3070@menu 3118@menu
@@ -3216,6 +3264,9 @@ the value of the expressions.
3216in the @code{display} text property. 3264in the @code{display} text property.
3217 3265
3218@table @code 3266@table @code
3267@item @var{string}
3268Display @var{string} instead of the text that has this property.
3269
3219@item (image . @var{image-props}) 3270@item (image . @var{image-props})
3220This display specification is an image descriptor (@pxref{Images}). 3271This display specification is an image descriptor (@pxref{Images}).
3221When used as a display specification, it means to display the image 3272When used as a display specification, it means to display the image