> What if we have a lazy image, so its FILE-OR-DATA is calculated at
> redisplay time. 'image-convert' could utilize this. One of the approaches
> to lazy images is to allow FILE-OR-DATA to be a function returning actual
> file or data. Redisplay could call this func and substitute the value of
> FILE-OR-DATA in image spec with the results, kind of caching the results.
It's definitely worth a try.
I just realized another benefit of such an approach. There is a long-standing bug in Emacs - when an image file is silently removed, there is no way to hook on this, so empty square displays in place of the image. In case of the function as FILE-OR-DATA, redisplay may call it once again if corresponding image file has been removed.
Maybe we can do that using the existing jit-lock hook?
I'll look at it, thanks