Subject: Re: bug#22472: 25.0.50; org-mode: latex fragments can't be un-rendered after a revert

From: Dima Kogan <[email-masked]>
Date: Wed, 03 Feb 2016 17:54:12 -0800

Dima Kogan <[email-masked]> writes:

> So a revert puts emacs into an inconsistent state, where the equation is
> rendered, but the source may or may not be there anymore, and where org
> doesn't think there's a render there at all.

This looks like an issue in emacs, rather than org. I think the right
solution is for a revert to delete all overlays. I.e.:

  (add-hook 'before-revert-hook 'delete-all-overlays)

This generally works, but is unideal because:

1. We'd want this to apply to org buffers, not to all emacs buffers

2. This works only if revert-buffer-function is nil or
revert-buffer--default.

If we don't want to delete overlays on revert, then
org-latex-fragment-image-overlays must be properly set to reflect the
overlay state, AND emacs should make sure the overlay is still valid on
revert.

Any particular thoughts?