# HG changeset patch # User Chong Yidong # Date 1181787733 0 # Node ID af6ed3b93a4826272ec2105a6b912d01600e30f4 # Parent 800f2a9f57ba2bfe29d216ce3668f3f05b28c3f2 (Image Cache): Document image-refresh. diff -r 800f2a9f57ba -r af6ed3b93a48 lispref/display.texi --- a/lispref/display.texi Thu Jun 14 02:22:03 2007 +0000 +++ b/lispref/display.texi Thu Jun 14 02:22:13 2007 +0000 @@ -4276,13 +4276,43 @@ @subsection Image Cache @cindex image cache - Emacs stores images in an image cache when it displays them, so it can -display them again more efficiently. It removes an image from the cache -when it hasn't been displayed for a specified period of time. - -When an image is looked up in the cache, its specification is compared -with cached image specifications using @code{equal}. This means that -all images with equal specifications share the same image in the cache. + Emacs stores images in an image cache so that it can display them +again more efficiently. When Emacs displays an image, it searches the +image cache for an existing image specification @code{equal} to the +desired specification. If a match is found, the image is displayed +from the cache; otherwise, Emacs loads the image normally. + + Occasionally, you may need to tell Emacs to refresh the images +associated with a given image specification. For example, suppose you +display an image using a specification that contains a @code{:file} +property. The image is loaded from the given file and stored in the +image cache. If you later display the image again, using the same +image specification, the image is displayed from the image cache. +Normally, this is not a problem. However, if the image file has +changed in the meantime, Emacs would be displaying the old version of +the image. In such a situation, it is necessary to ``refresh'' the +image using @code{image-refresh}. + +@defun image-refresh spec &optional frame +This function refreshes any images having image specifications +@code{equal} to @var{spec} on frame @var{frame}. If @var{frame} is +@code{nil}, the selected frame is used. If @var{frame} is @code{t}, +the refresh is applied to all existing frames. + +This works by removing all image with image specifications matching +@var{spec} from the image cache. Thus, the next time the image is +displayed, Emacs will load the image again. +@end defun + +@defun clear-image-cache &optional frame +This function clears the entire image cache. If @var{frame} is +non-@code{nil}, only the cache for that frame is cleared. Otherwise, +all frames' caches are cleared. +@end defun + +If an image in the image cache has not been displayed for a specified +period of time, Emacs removes it from the cache and frees the +associated memory. @defvar image-cache-eviction-delay This variable specifies the number of seconds an image can remain in the @@ -4294,12 +4324,6 @@ debugging. @end defvar -@defun clear-image-cache &optional frame -This function clears the image cache. If @var{frame} is non-@code{nil}, -only the cache for that frame is cleared. Otherwise all frames' caches -are cleared. -@end defun - @node Buttons @section Buttons @cindex buttons in buffers