diff options
| author | Richard M. Stallman | 2005-03-17 23:19:40 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-03-17 23:19:40 +0000 |
| commit | 4db6da64fbd2fbc57322e00141dd9ed22eeb7fde (patch) | |
| tree | fc845b0ffefd682560cdd9c2c7c00f56a706e117 | |
| parent | 9644814c81171f500482df6c4f02d110c9cc94fb (diff) | |
| download | emacs-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.texi | 53 |
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. | |||
| 3064 | insert images into text, and also control other aspects of how text | 3064 | insert images into text, and also control other aspects of how text |
| 3065 | displays. The value of the @code{display} property should be a | 3065 | displays. The value of the @code{display} property should be a |
| 3066 | display specification, or a list or vector containing several display | 3066 | display specification, or a list or vector containing several display |
| 3067 | specifications. The rest of this section describes several kinds of | 3067 | specifications. |
| 3068 | |||
| 3069 | Some kinds of @code{display} properties specify something to display | ||
| 3070 | instead of the text that has the property. In this case, ``the text'' | ||
| 3071 | means all the consecutive characters that have the same Lisp object as | ||
| 3072 | their @code{display} property; these characters are replaced as a | ||
| 3073 | single unit. By contrast, characters that have similar but distinct | ||
| 3074 | Lisp objects as their @code{display} properties are handled | ||
| 3075 | separately. 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 | ||
| 3089 | It 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 | ||
| 3091 | same string. The first two characters get the same string, so they | ||
| 3092 | together are replaced with one @samp{A}. The next two characters get | ||
| 3093 | a second string, so they together are replaced with one @samp{A}. | ||
| 3094 | Likewise for each following pair of characters. Thus, the ten | ||
| 3095 | characters appear as five A's. This function would have the same | ||
| 3096 | results: | ||
| 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 | ||
| 3109 | This illustrates that what matters is the property value for | ||
| 3110 | each character. If two consecutive characters have the same | ||
| 3111 | object as the @code{display} property value, it's irrelevent | ||
| 3112 | whether 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 | ||
| 3068 | display specifications and what they mean. | 3116 | display specifications and what they mean. |
| 3069 | 3117 | ||
| 3070 | @menu | 3118 | @menu |
| @@ -3216,6 +3264,9 @@ the value of the expressions. | |||
| 3216 | in the @code{display} text property. | 3264 | in the @code{display} text property. |
| 3217 | 3265 | ||
| 3218 | @table @code | 3266 | @table @code |
| 3267 | @item @var{string} | ||
| 3268 | Display @var{string} instead of the text that has this property. | ||
| 3269 | |||
| 3219 | @item (image . @var{image-props}) | 3270 | @item (image . @var{image-props}) |
| 3220 | This display specification is an image descriptor (@pxref{Images}). | 3271 | This display specification is an image descriptor (@pxref{Images}). |
| 3221 | When used as a display specification, it means to display the image | 3272 | When used as a display specification, it means to display the image |