[Top][All Lists]

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

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

From: Tassilo Horn
Subject: bug#16573: 24.3; Auctex (11.87.2) in Elpa issues hundreds of warnings on compile
Date: Fri, 31 Jan 2014 10:50:06 +0100
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> 1. Many TeX-* and LaTeX-* functions and variables are not generated
>>    before tex.el and latex.el are loaded.  AUCTeX has an auto parser
> [...]
>>    The byte-compiler doesn't seem to execute top-level funcalls, so all
>>    those functions/vars are unknown at compile-time.
> Indeed, the byte-compiler compiles the code, rather than executes it.
> But if it sees a (require 'foo) it will run that (require 'foo),
> i.e. it will load foo.el(c), which executes all of the code in there.
> So a (require 'tex) will execute (TeX-auto-add-type "symbol" "TeX") at
> compile-time, and will hence cause TeX-symbol-list to exist at
> compile-time.

Ah, ok, but that doesn't help when foo.el does (TeX-auto-add-type "foo"
"TeX") and uses the generated functions itself, like it's done by
tex.el, latex.el, and all style files that define their own auto
parsers.  Concretely, I still get warnings if tex.el uses
(TeX-symbol-list) generated by (TeX-auto-add-type "symbol" "TeX"), but
if latex uses the same function, it's ok for the compiler.

>>      (TeX-auto-add-type "acronym" "LaTeX")
> [...]
>> I guess I should wrap those TeX-auto-add-type calls with a
>> `eval-when-compile', right?
> You could.

No, I get a compile error in tex.el when compiling

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

because then TeX-auto-add-type is not known at compile-time.  So then
I'd need to wrap the defun, too, and also the function and variables
that are used in TeX-auto-add-type.  That doesn't seem manageable...

And if I wrap, e.g., the (TeX-auto-add-type "environment" "LaTeX") with
eval-with-compile, it compiles fine (cause it's in latex.el which
requires tex.el) and I get rid of some free-vars and unresolved
warnings, but then I get an error when finding a latex document.

  Debugger entered--Lisp error: (void-function LaTeX-add-environments-auto)

Wrapping with (eval-when (compile load eval) ...) seems to work, but I'm
not sure if that's a good idea.

> Or you could turn them into macros.

Indeed, that looks like a typical use-case for macros, but I'm rather
sure that there's a good reason that the auto parser stuff is like it
is.  David?

>> 3. How should one deal with code like this?
>>       (when (featurep 'font-latex)
>>         (font-latex-add-keywords ...))
>     (when (fboundp 'font-latex-add-keywords)
>       (font-latex-add-keywords ...))

While we are at it: David, is there any reason why somebody would want
to set TeX-install-font-lock to 'ignore nowadays so that font-latex is
not loaded?

If not, I'm tempted to remove the variable, require font-latex in
tex.el, and get rid of all those boundness checks in the styles.

>> 4. Or with code like this?
>>       (defun foo ()
>>         (require 'url-util)
>>         (url-util-* ...))
> Good question.  We usually use `declare-function' for these, but
> admittedly, it's not a great solution.

I see.  The reason for the code above is that foo is only callable in
very special conditions.  Concretely, there're some functions that are
only used with recent GNU emacs version with dbus support and the user
using Evince as pdf viewer.


reply via email to

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