help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Show who is requiring


From: Stefan Monnier
Subject: Re: Show who is requiring
Date: Mon, 10 Dec 2012 20:57:43 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> For some unknown reason (I mean: to me), `load-file-name' is sometimes nil,
> like if the requires came out of nowhere:

A require can happen when load-file-name is nil if that require is not
at some top-level in a file, but is instead inside a function.

> - vc-svn?

For this one it's vc-find-backend-function in vc-hooks.el which loads VC
backends on-demand.

> Why isn't `load-file-name' set to `org.el' in this case, then?

Because org.el has finished loading before org-load-modules-maybe is run.

> - calendar requires cal-menu, and vice versa
> - dired+ requires itself

"Recursive" requires are not very common but do happen every once in
a while.  It's usually better to restructure your code to avoid them,
but some authors don't want to bother (and the result is not always
really better because the resulting structure is a result of details of
implementation).

At other times it's because some functions defined are used during
compilation of the same file (e.g. they're used during
macro-expansion).  You can sometimes avoid self-requiring by using
eval-and-compile instead (as does eieio.el, which uses eval-and-compile
on a very large part of itself).


        Stefan




reply via email to

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