summaryrefslogtreecommitdiff
path: root/devdocs/elisp/image-cache.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/image-cache.html
new repository
Diffstat (limited to 'devdocs/elisp/image-cache.html')
-rw-r--r--devdocs/elisp/image-cache.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/devdocs/elisp/image-cache.html b/devdocs/elisp/image-cache.html
new file mode 100644
index 00000000..281dd4fc
--- /dev/null
+++ b/devdocs/elisp/image-cache.html
@@ -0,0 +1,18 @@
+ <h4 class="subsection">Image Cache</h4> <p>Emacs caches images 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</code> to the desired specification. If a match is found, the image is displayed from the cache. Otherwise, Emacs loads the image normally. </p> <dl> <dt id="image-flush">Function: <strong>image-flush</strong> <em>spec &amp;optional frame</em>
+</dt> <dd>
+<p>This function removes the image with specification <var>spec</var> from the image cache of frame <var>frame</var>. Image specifications are compared using <code>equal</code>. If <var>frame</var> is <code>nil</code>, it defaults to the selected frame. If <var>frame</var> is <code>t</code>, the image is flushed on all existing frames. </p> <p>In Emacs’s current implementation, each graphical terminal possesses an image cache, which is shared by all the frames on that terminal (see <a href="multiple-terminals">Multiple Terminals</a>). Thus, refreshing an image in one frame also refreshes it in all other frames on the same terminal. </p>
+</dd>
+</dl> <p>One use for <code>image-flush</code> is to tell Emacs about a change in an image file. If an image specification contains a <code>:file</code> property, the image is cached based on the file’s contents when the image is first displayed. Even if the file subsequently changes, Emacs continues displaying the old version of the image. Calling <code>image-flush</code> flushes the image from the cache, forcing Emacs to re-read the file the next time it needs to display that image. </p> <p>Another use for <code>image-flush</code> is for memory conservation. If your Lisp program creates a large number of temporary images over a period much shorter than <code>image-cache-eviction-delay</code> (see below), you can opt to flush unused images yourself, instead of waiting for Emacs to do it automatically. </p> <dl> <dt id="clear-image-cache">Function: <strong>clear-image-cache</strong> <em>&amp;optional filter</em>
+</dt> <dd><p>This function clears an image cache, removing all the images stored in it. If <var>filter</var> is omitted or <code>nil</code>, it clears the cache for the selected frame. If <var>filter</var> is a frame, it clears the cache for that frame. If <var>filter</var> is <code>t</code>, all image caches are cleared. Otherwise, <var>filter</var> is taken to be a file name, and all images associated with that file name are removed from all image caches. </p></dd>
+</dl> <p>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. </p> <dl> <dt id="image-cache-eviction-delay">Variable: <strong>image-cache-eviction-delay</strong>
+</dt> <dd>
+<p>This variable specifies the number of seconds an image can remain in the cache without being displayed. When an image is not displayed for this length of time, Emacs removes it from the image cache. </p> <p>Under some circumstances, if the number of images in the cache grows too large, the actual eviction delay may be shorter than this. </p> <p>If the value is <code>nil</code>, Emacs does not remove images from the cache except when you explicitly clear it. This mode can be useful for debugging. </p>
+</dd>
+</dl> <dl> <dt id="image-cache-size">Function: <strong>image-cache-size</strong>
+</dt> <dd><p>This function returns the total size of the current image cache, in bytes. An image of size 200x100 with 24 bits per color will have a cache size of 60000 bytes, for instance. </p></dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Image-Cache.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Image-Cache.html</a>
+ </p>
+</div>