Hello Paul,

On 10/12/2025, Paul D. Nelson wrote:
> Question: in the above scenario, should the old preview appear (covering
> the TeX source, like it did before we modified) as soon as point moves
> away, rather than just for a brief moment while the preview generates?

This behaviour is inherited from the current way of viewing previews. In
particular, when text is modified the preview is opened, and remains
open until it is re-generated.

I believe this is a reasonable behaviour. If I am editing text which
corresponds to a preview, then I likely want to go back to it to edit it
again and hiding it every time the cursor leaves the region creates
unnecessary friction while editing source. Also, I believe a reasonable
expectation is that the text should be replaced with a preview only if
the preview accurately reflects the source, otherwise the source should
always be visible.

If you are referring to the fact that the preview should not be "closed"
in the brief time while it is being regenerated (i.e. the source should
be visible), then I can look into modifying this behaviour (though I
suspect it will be annoying to fix due to the mechanism of replacing
images that is currently employed).

> A related point: the docs suggest that that 'always and 'off-point
> should yield the same behavior for previews away from point, but this is
> not the case after modifying a preview and moving point away.

I think it is the case that they are the same from the perspective of
showing/hiding overlays and frames which show symbols or previews (they
should be exactly the same when `preview-keep-stale-images` is nil). I
guess you are referring to what is being shown (icons vs previews). If
so, this is related to the other point I raised with the inconsistency
of `preview-keep-stale-images=t` and `preview-visibility-style =
'off-point`. So I discuss it below.

> I would have thought that "reusing the image" here would refer to what
> happens when point moves away from the modified TeX source, like in my
> response above.
>
> In fact, with
>
>   preview-visibility-style = 'off-point,
>
> does preview-keep-stale-images make any difference at all?

I may be misunderstanding you, but this is exactly my point.

With preview-visibility-style = 'off-point, when the cursor enters the
preview, the source is shown and an icon appears. When the cursor moves
away, the source is hidden and the preview reappears. This is the basic
use case: show the source at point; otherwise show the preview hiding
the source.

Now consider editing under the same setting. The cursor enters the
source, the icon appears, and the source is modified. As argued above,
the source should then remain visible when the cursor leaves to avoid
unnecessary editing friction. Given that, and with
preview-keep-stale-images set to t, what should happen when the cursor
leaves the source?

Currently, preview-keep-stale-images is effectively ignored and the icon
remains. This matches buframe behaviour: a stale preview is never shown
away from point. I also think this is consistent with 'off-point: when
the source is visible, the user does not want to see the preview.

The alternative is to replace the icon with the stale preview when the
cursor leaves. I tried this initially and found it jarring. The preview
appears with the source while the cursor is away, then is replaced with
an icon when the cursor re-enters the visible source. It felt like a
pointless visual gimmick with no clear benefit.

> I'm not at all sure about this, but would it make sense to fold
> preview-keep-stale-images into preview-visibility-style, effectively
> taking the value nil precisely when preview-visibility-style='off-point?
> I might have guessed that most people who learn about these settings
> will want to use either 'always or 'at-point as well as automatic
> previewing, which work best with preview-keep-stale-images = t.  One
> downside is that it would further complicate the docstring for
> preview-visibility-style.
I think keeping or removing stale images is an important customization
for 'always and 'at-point. I don't think the inconsistency between
'off-point and keeping stale images is enough of a reason to have such
restrictions. I prefer coming up with better names for the
customizations or documentation to resolve it.

Let's keep discussing the other points that I raised above and we can
revisit this suggestion.

> I did a quick search through my package repos for these functions, and
> they turned up only in https://github.com/ultronozm/czm-preview.el.
> That package has been deprecated for a bit over a year (it's superceded
> by patches to AUCTeX + preview-auto), but I suspect a couple colleagues
> are still using it, so maybe marking as obsolete would be the gentler
> approach.
Will do.

Best regards,
-- Al



_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to