unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: David Kastrup <dak@gnu.org>, Neil Jackson <neil.jackson@live.ca>,
	16573@debbugs.gnu.org
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	[thread overview]
Message-ID: <87eh3obhv5.fsf__9960.24525161392$1391161894$gmane$org@thinkpad-t61.fritz.box> (raw)
In-Reply-To: <jwv8utx4h41.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Thu, 30 Jan 2014 10:41:18 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> 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 (...) ...)
...
(eval-when-compile
  (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.

Bye,
Tassilo





  parent reply	other threads:[~2014-01-31  9:50 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 18:06 bug#16573: 24.3; Auctex (11.87.2) in Elpa issues hundreds of warnings on compile Neil Jackson
2014-01-27 18:23 ` Glenn Morris
2014-01-28  0:22 ` Stefan Monnier
     [not found] ` <jwvr47tdkm3.fsf-monnier+emacsbugs@gnu.org>
2014-01-28  8:14   ` Tassilo Horn
2014-01-28 17:27     ` Achim Gratz
2014-01-28 21:36       ` Stefan Monnier
2014-01-28 22:29         ` Achim Gratz
     [not found]         ` <87ppnb4u6p.fsf@Rainer.invalid>
2014-01-29  1:26           ` Stefan Monnier
2014-01-29  6:26             ` Achim Gratz
     [not found]             ` <87txcni9rj.fsf@Rainer.invalid>
2014-01-29 13:54               ` Stefan Monnier
2014-01-28  8:28   ` bug#16573: [Bug-AUCTeX] " Mosè Giordano
2014-01-29 19:30     ` Tassilo Horn
     [not found]     ` <87a9ee8u1y.fsf@thinkpad-t61.fritz.box>
2014-01-29 20:18       ` Glenn Morris
     [not found]       ` <o438k6y21d.fsf@fencepost.gnu.org>
2014-01-30  7:59         ` Tassilo Horn
     [not found]         ` <87ppn9nbn4.fsf@gnu.org>
2014-01-30  8:07           ` Glenn Morris
     [not found]           ` <yxmwidvqn4.fsf@fencepost.gnu.org>
2014-01-30 10:27             ` Tassilo Horn
     [not found]             ` <87lhxxn4rn.fsf@gnu.org>
2014-01-30 13:10               ` Mosè Giordano
2014-01-30 13:15               ` Tassilo Horn
     [not found]               ` <CAKtYQqRi74erbwpO7JWJiH0qThFxFP9nxmASzGbe+d0BXgW03g@mail.gmail.com>
2014-01-30 13:21                 ` Tassilo Horn
     [not found]                 ` <8761p1mwpm.fsf@gnu.org>
2014-01-30 15:34                   ` Stefan Monnier
     [not found]                   ` <jwveh3p4hob.fsf-monnier+emacsbugs@gnu.org>
2014-01-31  8:05                     ` Tassilo Horn
2014-01-31 14:38                       ` Stefan Monnier
     [not found]                       ` <jwvzjmcz093.fsf-monnier+emacsbugs@gnu.org>
2014-01-31 18:09                         ` Tassilo Horn
     [not found]               ` <87a9edmwzb.fsf@gnu.org>
2014-01-30 15:41                 ` Stefan Monnier
     [not found]                 ` <jwv8utx4h41.fsf-monnier+emacsbugs@gnu.org>
2014-01-31  9:50                   ` Tassilo Horn [this message]
     [not found]                   ` <87eh3obhv5.fsf@thinkpad-t61.fritz.box>
2014-01-31 10:05                     ` David Kastrup
     [not found]                     ` <877g9g4gak.fsf@fencepost.gnu.org>
2014-01-31 12:20                       ` Tassilo Horn
2014-01-31 14:49                     ` Stefan Monnier
     [not found]                     ` <jwvtxckz04b.fsf-monnier+emacsbugs@gnu.org>
2014-01-31 15:27                       ` Tassilo Horn
     [not found]   ` <87k3dkttex.fsf@gnu.org>
2014-01-28 17:07     ` Glenn Morris
2014-01-28 17:28       ` Thierry Volpiatto
2014-01-28 20:43       ` Tassilo Horn
     [not found]       ` <87eh3sm2xi.fsf__44933.1636344597$1390940459$gmane$org@gmail.com>
2014-01-29 20:00         ` Tassilo Horn
     [not found]         ` <8738k68sop.fsf@thinkpad-t61.fritz.box>
2014-01-30  5:53           ` Thierry Volpiatto
2020-08-21  1:29 ` Stefan Kangas
2021-08-27 10:35 ` Tassilo Horn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='87eh3obhv5.fsf__9960.24525161392$1391161894$gmane$org@thinkpad-t61.fritz.box' \
    --to=tsdh@gnu.org \
    --cc=16573@debbugs.gnu.org \
    --cc=dak@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=neil.jackson@live.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).