Subject: bug#70608: [PATCH] Make preview-region work outside LaTeX-mode buffers

From: Paul Nelson <[email-masked]>
Date: Sat, 4 May 2024 16:37:41 +0200

Hi Arash, OK, thanks for your response, please feel free to close. Thanks,
best,  Paul

On Sat, 4 May 2024 at 15:59, Arash Esbati <[email-masked]> wrote:

> Hi Paul,
>
> Paul Nelson <[email-masked]> writes:
>
> > This patch has no effect on existing behavior (in LaTeX-mode), but
> > makes it so that preview-region works in any non-LaTeX-mode buffer for
> > which TeX-master has been set to a valid tex file.  This is intended
> > for internal use by other packages.  For example, I've been using
> > something equivalent to this to preview org-mode LaTeX source blocks,
> > tex code in Lean4 comments, (...).
> >
> > (One could avoid this patch by manually initializing TeX-header-end
> > and TeX-trailer-start before calling preview-region, but it seems
> > better to me to provide working defaults as in the patch.  Any
> > feedback would be welcome, of course.)
>
> I'm a little reluctant about this change; tex.el provides generic
> functions/variables which are set by the modes; `TeX-header-end' and
> `TeX-trailer-start' are some of them.  My preference is what you
> describe above: If `preview-region' is used outside `LaTeX-mode', the 2
> variables should be initialized there somehow and not inside tex.el.
>
> Best, Arash
>