| 58 | | This function calls for redisplay of certain windows, the next time |
|---|
| 59 | | redisplay is done, but does not clear them first. |
|---|
| 60 | | |
|---|
| 61 | | @defun force-window-update &optional object |
|---|
| 62 | | This function forces some or all windows to be updated on next redisplay. |
|---|
| 63 | | If @var{object} is a window, it forces redisplay of that window. If |
|---|
| 64 | | @var{object} is a buffer or buffer name, it forces redisplay of all |
|---|
| 65 | | windows displaying that buffer. If @var{object} is @code{nil} (or |
|---|
| 66 | | omitted), it forces redisplay of all windows. |
|---|
| 67 | | @end defun |
|---|
| 68 | | |
|---|
| 69 | | Processing user input takes absolute priority over redisplay. If you |
|---|
| 70 | | call these functions when input is available, they do nothing |
|---|
| 71 | | immediately, but a full redisplay does happen eventually---after all the |
|---|
| 72 | | input has been processed. |
|---|
| | 58 | In Emacs, processing user input takes priority over redisplay. If |
|---|
| | 59 | you call these functions when input is available, they don't redisplay |
|---|
| | 60 | immediately, but the requested redisplay does happen |
|---|
| | 61 | eventually---after all the input has been processed. |
|---|
| | 81 | Emacs normally tries to redisplay the screen whenever it waits for |
|---|
| | 82 | input. With this function you can request an immediate attempt to |
|---|
| | 83 | redisplay, in the middle of Lisp code, without actually waiting for |
|---|
| | 84 | input. |
|---|
| | 85 | |
|---|
| | 86 | @defun redisplay &optional force |
|---|
| | 87 | This function tries immediately to redisplay, provided there are no |
|---|
| | 88 | pending input events. It is equivalent to @code{(sit-for 0)}. |
|---|
| | 89 | |
|---|
| | 90 | If the optional argument @var{force} is non-@code{nil}, it does all |
|---|
| | 91 | pending redisplay work even if input is available, with no |
|---|
| | 92 | pre-emption. |
|---|
| | 93 | |
|---|
| | 94 | The function returns @code{t} if it actually tried to redisplay, and |
|---|
| | 95 | @code{nil} otherwise. A value of @code{t} does not mean that |
|---|
| | 96 | redisplay proceeded to completion; it could have been pre-empted by |
|---|
| | 97 | newly arriving terminal input. |
|---|
| | 98 | @end defun |
|---|
| | 99 | |
|---|
| | 100 | @code{redisplay} with no argument tries immediately to redisplay, |
|---|
| | 101 | but has no effect on the usual rules for what parts of the screen to |
|---|
| | 102 | redisplay. By contrast, the following function adds certain windows |
|---|
| | 103 | to the pending redisplay work (as if their contents had completely |
|---|
| | 104 | changed), but doesn't immediately try to do any redisplay work. |
|---|
| | 105 | |
|---|
| | 106 | @defun force-window-update &optional object |
|---|
| | 107 | This function forces some or all windows to be updated on next |
|---|
| | 108 | redisplay. If @var{object} is a window, it requires eventual |
|---|
| | 109 | redisplay of that window. If @var{object} is a buffer or buffer name, |
|---|
| | 110 | it requires eventual redisplay of all windows displaying that buffer. |
|---|
| | 111 | If @var{object} is @code{nil} (or omitted), it requires eventual |
|---|
| | 112 | redisplay of all windows. |
|---|
| | 113 | @end defun |
|---|
| | 114 | |
|---|
| | 115 | @code{force-window-update} does not do a redisplay immediately. |
|---|
| | 116 | (Emacs will do that when it waits for input.) Rather, its effect is |
|---|
| | 117 | to put more work on the queue to be done by redisplay whenever there |
|---|
| | 118 | is a chance. |
|---|
| | 119 | |
|---|
| 109 | | |
|---|
| 110 | | @defvar redisplay-dont-pause |
|---|
| 111 | | If this variable is non-@code{nil}, pending input does not |
|---|
| 112 | | prevent or halt redisplay; redisplay occurs, and finishes, |
|---|
| 113 | | regardless of whether input is available. |
|---|
| 114 | | @end defvar |
|---|
| 115 | | |
|---|
| 116 | | @defun redisplay &optional force |
|---|
| 117 | | This function performs an immediate redisplay provided there are no |
|---|
| 118 | | pending input events. This is equivalent to @code{(sit-for 0)}. |
|---|
| 119 | | |
|---|
| 120 | | If the optional argument @var{force} is non-@code{nil}, it forces an |
|---|
| 121 | | immediate and complete redisplay even if input is available. |
|---|
| 122 | | |
|---|
| 123 | | Returns @code{t} if redisplay was performed, or @code{nil} otherwise. |
|---|
| 124 | | @end defun |
|---|
| 3234 | | specifications. |
|---|
| 3235 | | |
|---|
| 3236 | | Some kinds of @code{display} properties specify something to display |
|---|
| 3237 | | instead of the text that has the property. In this case, ``the text'' |
|---|
| 3238 | | means all the consecutive characters that have the same Lisp object as |
|---|
| 3239 | | their @code{display} property; these characters are replaced as a |
|---|
| 3240 | | single unit. By contrast, characters that have similar but distinct |
|---|
| 3241 | | Lisp objects as their @code{display} properties are handled |
|---|
| 3242 | | separately. Here's a function that illustrates this point: |
|---|
| | 3257 | specifications. Display specifications in the same @code{display} |
|---|
| | 3258 | property value generally apply in parallel to the text they cover. |
|---|
| | 3259 | |
|---|
| | 3260 | If several sources (overlays and/or a text property) specify values |
|---|
| | 3261 | for the @code{display} property, only one of the values takes effect, |
|---|
| | 3262 | following the rules of @code{get-char-property}. @xref{Examining |
|---|
| | 3263 | Properties}. |
|---|
| | 3264 | |
|---|
| | 3265 | The rest of this section describes several kinds of |
|---|
| | 3266 | display specifications and what they mean. |
|---|
| | 3267 | |
|---|
| | 3268 | @menu |
|---|
| | 3269 | * Replacing Specs:: Display specs that replace the text. |
|---|
| | 3270 | * Specified Space:: Displaying one space with a specified width. |
|---|
| | 3271 | * Pixel Specification:: Specifying space width or height in pixels. |
|---|
| | 3272 | * Other Display Specs:: Displaying an image; magnifying text; moving it |
|---|
| | 3273 | up or down on the page; adjusting the width |
|---|
| | 3274 | of spaces within text. |
|---|
| | 3275 | * Display Margins:: Displaying text or images to the side of the main text. |
|---|
| | 3276 | @end menu |
|---|
| | 3277 | |
|---|
| | 3278 | @node Replacing Specs |
|---|
| | 3279 | @subsection Display Specs That Replace The Text |
|---|
| | 3280 | |
|---|
| | 3281 | Some kinds of @code{display} specifications specify something to |
|---|
| | 3282 | display instead of the text that has the property. These are called |
|---|
| | 3283 | @dfn{replacing} display specifications. Emacs does not allow the user |
|---|
| | 3284 | to interactively move point into the middle of buffer text that is |
|---|
| | 3285 | replaced in this way. |
|---|
| | 3286 | |
|---|
| | 3287 | If a list of display specifications includes more than one replacing |
|---|
| | 3288 | display specification, the first overrides the rest. Replacing |
|---|
| | 3289 | display specifications make most other display specifications |
|---|
| | 3290 | irrelevant, since those don't apply to the replacement. |
|---|
| | 3291 | |
|---|
| | 3292 | For replacing display specifications, ``the text that has the |
|---|
| | 3293 | property'' means all the consecutive characters that have the same |
|---|
| | 3294 | Lisp object as their @code{display} property; these characters are |
|---|
| | 3295 | replaced as a single unit. By contrast, characters that have similar |
|---|
| | 3296 | but distinct Lisp objects as their @code{display} properties are |
|---|
| | 3297 | handled separately. Here's a function that illustrates this point: |
|---|
| 3532 | | A buffer can have blank areas called @dfn{display margins} on the left |
|---|
| 3533 | | and on the right. Ordinary text never appears in these areas, but you |
|---|
| 3534 | | can put things into the display margins using the @code{display} |
|---|
| 3535 | | property. |
|---|
| 3536 | | |
|---|
| 3537 | | To put text in the left or right display margin of the window, use a |
|---|
| 3538 | | display specification of the form @code{(margin right-margin)} or |
|---|
| 3539 | | @code{(margin left-margin)} on it. To put an image in a display margin, |
|---|
| 3540 | | use that display specification along with the display specification for |
|---|
| 3541 | | the image. Unfortunately, there is currently no way to make |
|---|
| 3542 | | text or images in the margin mouse-sensitive. |
|---|
| 3543 | | |
|---|
| 3544 | | If you put such a display specification directly on text in the |
|---|
| 3545 | | buffer, the specified margin display appears @emph{instead of} that |
|---|
| 3546 | | buffer text itself. To put something in the margin @emph{in |
|---|
| 3547 | | association with} certain buffer text without preventing or altering |
|---|
| 3548 | | the display of that text, put a @code{before-string} property on the |
|---|
| 3549 | | text and put the display specification on the contents of the |
|---|
| 3550 | | before-string. |
|---|
| | 3575 | A buffer can have blank areas called @dfn{display margins} on the |
|---|
| | 3576 | left and on the right. Ordinary text never appears in these areas, |
|---|
| | 3577 | but you can put things into the display margins using the |
|---|
| | 3578 | @code{display} property. There is currently no way to make text or |
|---|
| | 3579 | images in the margin mouse-sensitive. |
|---|
| | 3580 | |
|---|
| | 3581 | The way to display something in the margins is to specify it in a |
|---|
| | 3582 | margin display specification in the @code{display} property of some |
|---|
| | 3583 | text. This is a replacing display specification, meaning that the |
|---|
| | 3584 | text you put it on does not get displayed; the margin display appears, |
|---|
| | 3585 | but that text does not. |
|---|
| | 3586 | |
|---|
| | 3587 | A margin display specification looks like @code{((margin |
|---|
| | 3588 | right-margin) @var{spec}} or @code{((margin left-margin) @var{spec})}. |
|---|
| | 3589 | Here, @var{spec} is another display specification that says what to |
|---|
| | 3590 | display in the margin. Typically it is a string of text to display, |
|---|
| | 3591 | or an image descriptor. |
|---|
| | 3592 | |
|---|
| | 3593 | To display something in the margin @emph{in association with} |
|---|
| | 3594 | certain buffer text, without altering or preventing the display of |
|---|
| | 3595 | that text, put a @code{before-string} property on the text and put the |
|---|
| | 3596 | margin display specification on the contents of the before-string. |
|---|
| 4278 | | Emacs stores images in an image cache when it displays them, so it can |
|---|
| 4279 | | display them again more efficiently. It removes an image from the cache |
|---|
| 4280 | | when it hasn't been displayed for a specified period of time. |
|---|
| 4281 | | |
|---|
| 4282 | | When an image is looked up in the cache, its specification is compared |
|---|
| 4283 | | with cached image specifications using @code{equal}. This means that |
|---|
| 4284 | | all images with equal specifications share the same image in the cache. |
|---|
| | 4322 | Emacs stores images in an image cache so that it can display them |
|---|
| | 4323 | again more efficiently. When Emacs displays an image, it searches the |
|---|
| | 4324 | image cache for an existing image specification @code{equal} to the |
|---|
| | 4325 | desired specification. If a match is found, the image is displayed |
|---|
| | 4326 | from the cache; otherwise, Emacs loads the image normally. |
|---|
| | 4327 | |
|---|
| | 4328 | Occasionally, you may need to tell Emacs to refresh the images |
|---|
| | 4329 | associated with a given image specification. For example, suppose you |
|---|
| | 4330 | display an image using a specification that contains a @code{:file} |
|---|
| | 4331 | property. The image is loaded from the given file and stored in the |
|---|
| | 4332 | image cache. If you later display the image again, using the same |
|---|
| | 4333 | image specification, the image is displayed from the image cache. |
|---|
| | 4334 | Normally, this is not a problem. However, if the image file has |
|---|
| | 4335 | changed in the meantime, Emacs would be displaying the old version of |
|---|
| | 4336 | the image. In such a situation, it is necessary to ``refresh'' the |
|---|
| | 4337 | image using @code{image-refresh}. |
|---|
| | 4338 | |
|---|
| | 4339 | @defun image-refresh spec &optional frame |
|---|
| | 4340 | This function refreshes any images having image specifications |
|---|
| | 4341 | @code{equal} to @var{spec} on frame @var{frame}. If @var{frame} is |
|---|
| | 4342 | @code{nil}, the selected frame is used. If @var{frame} is @code{t}, |
|---|
| | 4343 | the refresh is applied to all existing frames. |
|---|
| | 4344 | |
|---|
| | 4345 | This works by removing all image with image specifications matching |
|---|
| | 4346 | @var{spec} from the image cache. Thus, the next time the image is |
|---|
| | 4347 | displayed, Emacs will load the image again. |
|---|
| | 4348 | @end defun |
|---|
| | 4349 | |
|---|
| | 4350 | @defun clear-image-cache &optional frame |
|---|
| | 4351 | This function clears the entire image cache. If @var{frame} is |
|---|
| | 4352 | non-@code{nil}, only the cache for that frame is cleared. Otherwise, |
|---|
| | 4353 | all frames' caches are cleared. |
|---|
| | 4354 | @end defun |
|---|
| | 4355 | |
|---|
| | 4356 | If an image in the image cache has not been displayed for a specified |
|---|
| | 4357 | period of time, Emacs removes it from the cache and frees the |
|---|
| | 4358 | associated memory. |
|---|