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

From: Arash Esbati <[email-masked]>
Date: Mon, 24 Feb 2025 20:40:17 +0100

Hi Keita,

Ikumi Keita <[email-masked]> writes:

> Thanks, now I realize what is difficult. What we are facing is related
> to this comment in `TeX-run-style-hooks':
> ;; This happens in case some style added a new parser, and
> ;; now the style isn't used anymore (user deleted
> ;; \usepackage{style}).  Then we're left over with, e.g.,
> ;; (LaTeX-add-siunitx-units "\\parsec"), but the function is
> ;; defined in a style siunitx.el that's not loaded anymore.
>
> The problem is hard to solve because it is almost impossible for AUCTeX
> to be aware that the user has deleted or commented out \usepackage :-(

Thanks.  Indeed, AUCTeX will know about a removed \usepackage after the
next re-parse, which can be late.

> ...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.

Best, Arash