Subject: bug#59902: 30.0.50; Image overlay is not updated until the cursor moves to the overlay

From: Ihor Radchenko <[email-masked]>
Date: Sun, 11 Dec 2022 09:19:16 +0000

Eli Zaretskii <[email-masked]> writes:

>> > You want Emacs to hit the disk and process the file on each redisplay
>> > cycle?
>> 
>> No. It can be less frequent. Maybe just when a new image view is created
>> (like in overlay). Or maybe on timer - make images in the image cache
>> expire after some time.
>
> The image-handling code doesn't necessarily know where the image came
> from.
>
> The idea of clearing images from time to time was discussed, but AFAIR
> we didn't find a good way that fits all the needs for doing so.

Are you referring to https://debbugs.gnu.org/cgi/bugreport.cgi?bug=33275
?

I do not see anyone proposing cache expiry time there. Expiry is not
really related to this particular bug report, but might be a good idea
to help large memory consumption that is reported from time to time (I
reported once for pdfs and I have seen people report memory issues with
images).

> I think this is best left to the application level.  In particular, in
> this case, the application _knows_ when it will replace the image
> file.

No. Not really. Source block execution does not pass any information
about updating/not updating images to Org image display code. Even if it
did, the same issue could appear when the image file changes on disk
outside Emacs.

I was still able to make some improvements in Org's image code thanks to
your replies.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a12d15df9

Yet, do note that flickering two different image versions when moving
point is unexpected even considering the information you provided.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>