Subject: Re: bug#70409: 30.0.50; `latexenc-find-file-coding-system` uses `TeX-master` before we know it's safe

From: Eli Zaretskii <[email-masked]>
Date: Tue, 16 Apr 2024 16:35:53 +0300

> From: Stefan Monnier <[email-masked]>
> Cc: [email-masked]
> Date: Tue, 16 Apr 2024 08:53:13 -0400
> 
> > Is it correct for latexenc-find-file-coding-system to use
> > find-file-noselect for this purpose?
> 
> That's another question.  My question is instead whether it's safe for
> `latexenc-find-file-coding-system` to use the `TeX-master` setting in
> foo.tex`.  I can imagine cases where that setting could be dangerous
> because it tricks the users into accessing a file they shouldn't access.

But wouldn't processing the file in a "more literal" manner solve that
problem as well?  We only process file-local variables when we turn on
the proper major mode, so avoiding to turn on a mode will also solve
the problem you have, including unsafe variables.  And finding the
telltale signature of the file's encoding doesn't need any major
mode's help, does it?