auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TeX-remove-style-hook is local


From: Tassilo Horn
Subject: Re: TeX-remove-style-hook is local
Date: Thu, 28 May 2020 18:23:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

Hi Stefan,

> I'd like to install the patch below but would like some confirmation
> that my understanding is right.
>
> AFAICT, `TeX-auto-add-type` is a macro that's run exclusively at the
> top-level of some of AUCTeX's files (context.el, tex.el, and
> latex.el),

No, there are many styles which use it in their style hooks, much more
than those in (la)tex.el/context.el.

> and it uses `add-hook` without a "local" argument in order to add a
> function to `TeX-remove-style-hook`, but that variable is declared
> buffer-local which makes `add-hook` operate on the buffer-local part
> of the hook rather than on the local part.
>
> My understanding is that the intention is to add the function on the
> global part of the hook, which is what the patch below does.  If the
> intention is to add it buffer-locally, then the code will need to be
> restructured since the `add-hook` currently runs only when loading
> AUCTeX and not when enabling the mode.

No, I don't think so.  The top-level occurrences of `TeX-auto-add-type'
just add the standard (La)TeX types.  You will never "unload" those.

The important parts are the TeX-auto-add-type calls inside style hooks
because you can stop using some style (package) in some document.  And
then, the information parsed for that styles types needs to be erased by
running the buffer-local TeX-remove-style-hook functions which set the
generated buffer-local lists to nil.

BTW: I wonder in which buffer-local TeX-remove-style-hook the lambdas
setting LaTeX-label-list to nil end up, i.e., those that get defined at
load-time.  What buffer is active then?

Bye,
Tassilo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]