help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I avoid using `clear-image-cache'?


From: Thien-Thi Nguyen
Subject: Re: Can I avoid using `clear-image-cache'?
Date: Fri, 06 May 2005 12:35:32 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Mathias Dahl <address@hidden> writes:

> I probably can change the code to work the way
> `insert-image-file' does, but I would rather like to, in some
> way, be able to flush one particular image from the image cache.
>
> Can this be done or do I need to write a more advanced piece of code?

yes. ;-)

> For now I will use `clear-image-cache' although it feels "ugly".

i just looked at image.c:1661 (lookup_image), which sez:

  /* If not found, create a new image and cache it.  */
  if (img == NULL)

probably immediately prior to this block is the best place to add
a file timestamp check.  that's not as pretty a solution as fully
generalizing the check to some kind of `:volatile VOLATILE-SPEC':

  :volatile VOLATILE-SPEC

  If VOLATILE-SPEC is t, take extra steps to check for "image
  change" so that image-cache lookup can DTRT [obviously this
  documentation can be improved ;-].  If :file is specified,
  use the timestamp of the file.  Otherwise, compute a hash of
  the data and use that to detect change.

  VOLATILE-SPEC may also be a function that takes one argument,
  either the file timestamp or the data (as a string), and returns
  non-nil to indicate that the image has changed.

i was all fired up and ready to do some quick munging and post
code (thereby procrastinating on other emacs munging for vms :-),
but then i saw how image.c leaves file loading to each image type
(not enough abstraction for my tastes) so all the gumption seeped
away...

perhaps post-release i (or someone else) will do the requisite
refactoring so that :volatile or like can be added more easily.

thi


reply via email to

[Prev in Thread] Current Thread [Next in Thread]