unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Can I avoid using `clear-image-cache'?
@ 2005-05-06  9:27 Mathias Dahl
  2005-05-06 10:35 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Mathias Dahl @ 2005-05-06  9:27 UTC (permalink / raw)


I am currently developing a little package, tumme.el, to browse images
in Emacs. It is similar to thumbs.el but quite different too.

I have code that inserts thumbnail versions of images into a buffer,
like this:

  (defun tumme-ins-img (file original-file-name
                             associated-dired-buffer)
    "Insert thumbnail image."
    (let (beg end tags
              (i `(image :type ,'jpeg
                         :file ,file
                         :relief ,tumme-thumb-relief
                         :margin ,tumme-thumb-margin)))
      (setq beg (point))
      (insert-image i)
      (setq end (point))
      (add-text-properties
       beg end
       (list 'original-file-name original-file-name
             'associated-dired-buffer associated-dired-buffer
             'tags (tumme-list-tags original-file-name)))))

The problem is that if I rotate the thumbnail image (using the tools
from ImageMagick), removes and inserts the image again, the image is
fetched from Emacs' image cache. Therefor I need to clear the cache
using `clear-image-cache' so that it loads the file from disk.

Now, I know that this can be done in other ways. For example
`insert-image-file' does not have this problem as it puts the image
bytes into the text properties, while they way I use `insert-image'
will insert the file name. 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?

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

/Mathias

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-05-09  6:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-06  9:27 Can I avoid using `clear-image-cache'? Mathias Dahl
2005-05-06 10:35 ` Thien-Thi Nguyen
2005-05-09  6:01   ` Mathias Dahl

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).