Subject: bug#16573: 24.3; Auctex (11.87.2) in Elpa issues hundreds of warnings on compile

From: Tassilo Horn <[email-masked]>
Date: Thu, 30 Jan 2014 14:15:52 +0100

Tassilo Horn <[email-masked]> writes:

>> Why can't the style files require whatever AUCTeX files they need?
>
> They could, I guess.

I was wrong.  I've just added the needed requires to all style files,
but I get exactly as many warnings as before.  This is because of these
reasons.

1. Many TeX-* and LaTeX-* functions and variables are not generated
   before tex.el and latex.el are loaded.  AUCTeX has an auto parser
   facility that generates a parser for some kind of LaTeX thingy.
   Typical "thingies" in LaTeX are symbols/macros, environments,
   lengths, counters, or labels.  For each such thingy, functions and
   variables named TeX-thingy-* or LaTeX-thingy-* are generated.  E.g.,
   tex.el itself does

     (TeX-auto-add-type "symbol" "TeX")

   which generates functions/vars TeX-symbol-list,
   TeX-symbol-list-filtered, TeX-symbol-changed, etc.  (And the same for
   10 other thingies.)

   The byte-compiler doesn't seem to execute top-level funcalls, so all
   those functions/vars are unknown at compile-time.

2. The AUCTeX's auto parser is open to be used for style-files, too.
   For example, style/acronym.el does

     (TeX-auto-add-type "acronym" "LaTeX")

   which when evaluated creates LaTeX-acronym-list, etc.  Again, those
   are unknown to the byte-compiler.

I guess I should wrap those TeX-auto-add-type calls with a
`eval-when-compile', right?

3. How should one deal with code like this?

      (when (featurep 'font-latex)
        (font-latex-add-keywords ...))

4. Or with code like this?

      (defun foo ()
        (require 'url-util)
        (url-util-* ...))

Thanks,
Tassilo