unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: alkibiades@gmx.de
Cc: emacs-devel@gnu.org
Subject: Re: XPM via Lisp in the toolbar
Date: Sun, 17 Nov 2002 13:30:12 +0100	[thread overview]
Message-ID: <uel9kidkb.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: <E18DJet-0001iH-00@fencepost.gnu.org> (Richard Stallman's message of "Sun, 17 Nov 2002 02:15:55 -0500")

Richard Stallman <rms@gnu.org> writes:

>     As long as the image is not _explicitly_ re-read from disk as in my
>     example and as long as the image descriptor is not garbage collected,
>     this should already be the case. Not even clearing the image cache (I
>     mean the built-in image cache) would cause a second conversion,
>     because the image descriptor contains all image data as a value of the
>     :data attribute.
>
> Are you sure that the same image is not likely to be read from disk
> many times in an Emacs session?  I don't know for certain, but I would
> have expected that to be common.

I don't know the C code behind that -- so please read the following
with that reservatio mentalis. But as far as I understand the issue,
it won't happen.

AFAICS it is prevented on two stages:

The Emacs Lisp Reference says about the 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 `equal'.  This means
| that all images with equal specifications share the same image in the
| cache.
`----

The variable `image-cache-eviction-delay' controls how long an image
may remain in the image cache without being displayed. The default is
30 minutes.

Normally -- that is: without xpm.el -- the image descriptor for an
icon in the tool bar would look like this:

(image :file "/some/path/search.xpm" :type xpm ... )

So if the icon was not displayed for 30 minutes and Emacs has to
display it again, it would read "search.xpm" from the disk again. That
is how I understand it.

But with `xpm-create-image' hooked into `find-image' as a fall-back
for XPMs the image descriptor looks like this:

(image :data "P6 32 32 255 ... <binary data> ..." :type pbm ... )

So as far as Emacs is concerned there is no file attached to the image
anymore. The string after :data contains the whole information
necessary to display the image.

I don't know whether an image descriptor in `tool-bar-map' has any
chance to get garbage collected. As long as this does not happen,
there is no need to read the image from the disk again. To read the
image from the disk again, it would need another explicit call to
`find-image'. I wouldn't know where in the code this latter could take
place, BTW.

    Oliver
-- 
Oliver Scholz               27 Brumaire an 211 de la Révolution
Taunusstr. 25               Liberté, Egalité, Fraternité!
60329 Frankfurt a. M.       http://www.jungdemokratenhessen.de
Tel. (069) 97 40 99 42      http://www.jdjl.org

  reply	other threads:[~2002-11-17 12:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-12 17:32 XPM via Lisp in the toolbar Oliver Scholz
2002-11-13 17:15 ` Oliver Scholz
2002-11-15  2:36   ` Richard Stallman
2002-11-15  3:31     ` alkibiades
2002-11-15 14:08       ` Stefan Monnier
2002-11-16 14:51       ` Richard Stallman
2002-11-16 14:51       ` Richard Stallman
2002-11-16 18:44         ` alkibiades
2002-11-17  7:15           ` Richard Stallman
2002-11-17 12:30             ` alkibiades [this message]
2002-11-17 12:49               ` Oliver Scholz
2002-11-15 15:06     ` Jason Rumney
2002-11-15 18:06       ` Jason Rumney
2002-11-18 14:08       ` Oliver Scholz
2002-11-18 16:59         ` mushroom icon [was: Re: XPM via Lisp in the toolbar] John Paul Wallington
2002-11-18 19:38         ` XPM via Lisp in the toolbar Jason Rumney
2002-11-14  4:10 ` Richard Stallman
2002-11-15 17:47 ` W32 image patch (was Re: XPM via Lisp in the toolbar) Jason Rumney
2002-11-19  8:51   ` bootstrap fails with current CVS on MS Windows XP Oliver Scholz
2002-11-19  9:30     ` Juanma Barranquero
2002-11-20 21:13     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uel9kidkb.fsf@ID-87814.user.dfncis.de \
    --to=alkibiades@gmx.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).