Subject: Re: bug#70807: Resetting *-local variables before parsing

From: Ikumi Keita <[email-masked]>
Date: Thu, 27 Feb 2025 23:49:35 +0900

Hi Arash,

>>>>> Arash Esbati <[email-masked]> writes:
> Ikumi Keita <[email-masked]> writes:
>> ...Hmm, I began to be puzzled. I realize that I'm not sure why we need
>> the entries for `LaTeX-verbatim-macros-with-delims-local' in
>> parsed-file.el. `TeX-run-style-hooks' in the parsed-file.el runs hooks
>> associated with "hyperref", one of which adds various items to -local
>> variables as expected, even for child files which are \include'd or
>> \input'ted. What am I missing?

> Probably the same bit I'm missing 🧐  I always wondered why that
> information is written to a parsed-file.el because of the reasons you
> mentioned above.

OK, I see. This feature was introduced by this commit:
,----
| d3d05d462afbe69687277f7fc0dd09e6ef2ff113
| Author:     Tassilo Horn <[email-masked]>
| AuthorDate: Sat Dec 20 09:10:47 2014 +0100
| Commit:     Tassilo Horn <[email-masked]>
| CommitDate: Sat Dec 20 09:10:47 2014 +0100
| 
| Make some buffer-local vars document-local.
| 
| * tex.el (TeX-auto-store): Write LaTeX-verbatim-*-local variables
| to auto file to make them document-local.
`----
Tassilo explained the detail in [1]:
,----
| But this only
| works in singe-file documents.  As soon as you have
| 
|   preamble.tex % lots of \newminted defs
|   main.tex     % here the generated environments are used
| 
| where main.tex is the `TeX-master' the declaration that elispcode and
| elispcode* are verbatim environments is only available in preamble.tex,
| not in the master (or rather the complete doc).
`----

minted.el adds new elements to LaTeX-verbatim-*-local variables
dynamically based on parsing, in `LaTeX-minted-auto-cleanup' added in
`TeX-auto-cleanup-hook'. Hence, without the entries for
LaTeX-verbatim-*-local variables in the parsed-file.el, the main file
wouldn't know the new verbatim constructs, because in the main.tex
buffer, AUCTeX parses only main.tex, not the child preamble.tex. :-(

I'll ponder to seek some good idea, but probably I'll fail...

[1] https://lists.gnu.org/r/auctex/2014-12/msg00044.html
    https://lists.gnu.org/r/auctex/2014-12/msg00049.html

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine
#Gaza #StopMassiveKilling #CeasefireNOW