[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Can I avoid using `clear-image-cache'?
From: |
Mathias Dahl |
Subject: |
Can I avoid using `clear-image-cache'? |
Date: |
Fri, 06 May 2005 11:27:15 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (windows-nt) |
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
- Can I avoid using `clear-image-cache'?,
Mathias Dahl <=