aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2010-05-22 12:48:01 -0400
committerChong Yidong2010-05-22 12:48:01 -0400
commit110683addccf829fa2b98fa279246f60a228d4fa (patch)
treecd79923115846b4f226a3d2d32f767bbf7feee9c
parent4e3028f8f788c646a184f74f13c6e8ec0bc61b81 (diff)
downloademacs-110683addccf829fa2b98fa279246f60a228d4fa.tar.gz
emacs-110683addccf829fa2b98fa279246f60a228d4fa.zip
Rename image-refresh to image-flush.
* image.c (Fimage_flush): Rename from image-refresh. * image.el (image-refresh): Define as an alias for image-flush. * image-mode.el (image-toggle-display-image): Caller changed. * display.texi (Image Cache): Update documentation about image caching.
-rw-r--r--doc/lispref/display.texi53
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/image-mode.el4
-rw-r--r--lisp/image.el1
-rw-r--r--src/ChangeLog4
-rw-r--r--src/image.c12
6 files changed, 51 insertions, 29 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 68631dcdefc..622de2cd3cf 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -4730,29 +4730,35 @@ cache, it can always be displayed, even if the value of
4730efficiently. When Emacs displays an image, it searches the image 4730efficiently. When Emacs displays an image, it searches the image
4731cache for an existing image specification @code{equal} to the desired 4731cache for an existing image specification @code{equal} to the desired
4732specification. If a match is found, the image is displayed from the 4732specification. If a match is found, the image is displayed from the
4733cache; otherwise, Emacs loads the image normally. 4733cache. Otherwise, Emacs loads the image normally.
4734 4734
4735 Occasionally, you may need to tell Emacs to refresh the images 4735@defun image-flush spec &optional frame
4736associated with a given image specification. For example, suppose you 4736This function removes the image with specification @var{spec} from the
4737display an image using a specification that contains a @code{:file} 4737image cache of frame @var{frame}. Image specifications are compared
4738property. The image is automatically cached, and subsequent displays 4738using @code{equal}. If @var{frame} is @code{nil}, it defaults to the
4739of that image, with the same image specification, will use the image 4739selected frame. If @var{frame} is @code{t}, the image is flushed on
4740cache. If the image file changes in the meantime, Emacs would be 4740all existing frames.
4741displaying the old version of the image. In such a situation, you can 4741
4742``refresh'' the image by calling @code{image-refresh}. 4742In Emacs' current implementation, each graphical terminal possesses an
4743 4743image cache, which is shared by all the frames on that terminal
4744 In Emacs' current implementation, each graphical terminal possesses
4745an image cache, which is shared by all the frames on that terminal
4746(@pxref{Multiple Terminals}). Thus, refreshing an image in one frame 4744(@pxref{Multiple Terminals}). Thus, refreshing an image in one frame
4747also refreshes it in all other frames on the same terminal. 4745also refreshes it in all other frames on the same terminal.
4748
4749@defun image-refresh spec &optional frame
4750This function refreshes any images with image specifications
4751@code{equal} to @var{spec} on frame @var{frame}. If @var{frame} is
4752@code{nil}, it defaults to the selected frame. If @var{frame} is
4753@code{t}, the refresh is applied to all existing frames.
4754@end defun 4746@end defun
4755 4747
4748 One use for @code{image-flush} is to tell Emacs about a change in an
4749image file. If an image specification contains a @code{:file}
4750property, the image is cached based on the file's contents when the
4751image is first displayed. Even if the file subsequently changes,
4752Emacs continues displaying the old version of the image. Calling
4753@code{image-flush} flushes the image from the cache, forcing Emacs to
4754re-read the file the next time it needs to display that image.
4755
4756 Another use for @code{image-flush} is for memory conservation. If
4757your Lisp program creates a large number of temporary images over a
4758period much shorter than @code{image-cache-eviction-delay} (see
4759below), you can opt to flush unused images yourself, instead of
4760waiting for Emacs to do it automatically.
4761
4756@defun clear-image-cache &optional filter 4762@defun clear-image-cache &optional filter
4757This function clears an image cache, removing all the images stored in 4763This function clears an image cache, removing all the images stored in
4758it. If @var{filter} is omitted or @code{nil}, it clears the cache for 4764it. If @var{filter} is omitted or @code{nil}, it clears the cache for
@@ -4768,9 +4774,12 @@ period of time, Emacs removes it from the cache and frees the
4768associated memory. 4774associated memory.
4769 4775
4770@defvar image-cache-eviction-delay 4776@defvar image-cache-eviction-delay
4771This variable specifies the number of seconds an image can remain in the 4777This variable specifies the number of seconds an image can remain in
4772cache without being displayed. When an image is not displayed for this 4778the cache without being displayed. When an image is not displayed for
4773length of time, Emacs removes it from the image cache. 4779this length of time, Emacs removes it from the image cache.
4780
4781Under some circumstances, if the number of images in the cache grows
4782too large, the actual eviction delay may be shorter than this.
4774 4783
4775If the value is @code{nil}, Emacs does not remove images from the cache 4784If the value is @code{nil}, Emacs does not remove images from the cache
4776except when you explicitly clear it. This mode can be useful for 4785except when you explicitly clear it. This mode can be useful for
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e59c4a45c29..72f00e60edf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12010-05-22 Chong Yidong <cyd@stupidchicken.com>
2
3 * image.el (image-refresh): Define as an alias for image-flush.
4
5 * image-mode.el (image-toggle-display-image): Caller changed.
6
12010-05-21 Juri Linkov <juri@jurta.org> 72010-05-21 Juri Linkov <juri@jurta.org>
2 8
3 * progmodes/grep.el (grep-read-files): Fix multi-pattern aliases. 9 * progmodes/grep.el (grep-read-files): Fix multi-pattern aliases.
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index dfc96bb4a16..f1323563d5d 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -448,7 +448,7 @@ Remove text properties that display the image."
448 448
449(defvar archive-superior-buffer) 449(defvar archive-superior-buffer)
450(defvar tar-superior-buffer) 450(defvar tar-superior-buffer)
451(declare-function image-refresh "image.c" (spec &optional frame)) 451(declare-function image-flush "image.c" (spec &optional frame))
452 452
453(defun image-toggle-display-image () 453(defun image-toggle-display-image ()
454 "Show the image of the image file. 454 "Show the image of the image file.
@@ -477,7 +477,7 @@ was inserted."
477 (inhibit-read-only t) 477 (inhibit-read-only t)
478 (buffer-undo-list t) 478 (buffer-undo-list t)
479 (modified (buffer-modified-p))) 479 (modified (buffer-modified-p)))
480 (image-refresh image) 480 (image-flush image)
481 (let ((buffer-file-truename nil)) ; avoid changing dir mtime by lock_file 481 (let ((buffer-file-truename nil)) ; avoid changing dir mtime by lock_file
482 (add-text-properties (point-min) (point-max) props) 482 (add-text-properties (point-min) (point-max) props)
483 (restore-buffer-modified-p modified)) 483 (restore-buffer-modified-p modified))
diff --git a/lisp/image.el b/lisp/image.el
index 67c1ad946b1..b3a0f1a8a7d 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -30,6 +30,7 @@
30 "Image support." 30 "Image support."
31 :group 'multimedia) 31 :group 'multimedia)
32 32
33(defalias 'image-refresh 'image-flush)
33 34
34(defconst image-type-header-regexps 35(defconst image-type-header-regexps
35 `(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm) 36 `(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
diff --git a/src/ChangeLog b/src/ChangeLog
index f0613a57405..489505f3cf3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
12010-05-22 Chong Yidong <cyd@stupidchicken.com>
2
3 * image.c (Fimage_flush): Rename from image-refresh.
4
12010-05-21 Chong Yidong <cyd@stupidchicken.com> 52010-05-21 Chong Yidong <cyd@stupidchicken.com>
2 6
3 * xdisp.c (redisplay_internal): Clear caches even if redisplaying 7 * xdisp.c (redisplay_internal): Clear caches even if redisplaying
diff --git a/src/image.c b/src/image.c
index 5d4f50ee85e..b9620e10948 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1689,11 +1689,13 @@ which is then usually a filename. */)
1689} 1689}
1690 1690
1691 1691
1692DEFUN ("image-refresh", Fimage_refresh, Simage_refresh, 1692DEFUN ("image-flush", Fimage_flush, Simage_flush,
1693 1, 2, 0, 1693 1, 2, 0,
1694 doc: /* Refresh the image with specification SPEC on frame FRAME. 1694 doc: /* Fush the image with specification SPEC on frame FRAME.
1695If SPEC specifies an image file, the displayed image is updated with 1695This removes the image from the Emacs image cache. If SPEC specifies
1696the current contents of that file. 1696an image file, the next redisplay of this image will read from the
1697current contents of that file.
1698
1697FRAME nil or omitted means use the selected frame. 1699FRAME nil or omitted means use the selected frame.
1698FRAME t means refresh the image on all frames. */) 1700FRAME t means refresh the image on all frames. */)
1699 (spec, frame) 1701 (spec, frame)
@@ -8526,7 +8528,7 @@ non-numeric, there is no explicit limit on the size of images. */);
8526 8528
8527 defsubr (&Sinit_image_library); 8529 defsubr (&Sinit_image_library);
8528 defsubr (&Sclear_image_cache); 8530 defsubr (&Sclear_image_cache);
8529 defsubr (&Simage_refresh); 8531 defsubr (&Simage_flush);
8530 defsubr (&Simage_size); 8532 defsubr (&Simage_size);
8531 defsubr (&Simage_mask_p); 8533 defsubr (&Simage_mask_p);
8532 defsubr (&Simage_metadata); 8534 defsubr (&Simage_metadata);