Tassilo Horn <t...@gnu.org> writes: > 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.
Oh, after having a second look, I confess I am wrong and TeX-remove-style-hook shouldn't be buffer-local. Or alternatively, we could ensure that all TeX-auto-add-type calls happen in style hooks and also move the standard (La)TeX/ConTeXt calls into their respective mode functions, so that they will always happen when the current buffer is the tex document (and not during load time). But the first option is much simpler and has only the slight disadvantage that more cheap lambdas might be called because now TeX-remove-style-hook contains all clearance lambdas of all styles one has ever used in some document in this emacs session. I've committed your patch (except for the FIXME which I guess was more of a note to us AUCTeX maintainers). Thanks a lot, Tassilo