[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (require ...) and file dependencies.
From: |
Stefan Monnier |
Subject: |
Re: (require ...) and file dependencies. |
Date: |
Sat, 27 Dec 2014 19:22:34 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> They may fixed by:
>
> (eval-when-compile
> (defvar ...))
No, it's fixed with
(defvar <foo>)
Siuch (defvar <foo>) declarations (i.e. without an initial value) are
annotations for the *compiler*, so you don't want to pas them to the
`eval'uator (hence you don't want to wrap them in `eval-when-compile').
The fact that they also work when wrapped in `eval-when-compile' is an
accident which might get fixed at any point.
> Warning: the function `...' is not known to be defined.
For these you have (declare-function ...)
> Is that right to use (this is used in CEDET):
>
> (eval-when-compile
> (require 'xxx-mode))
In general, no, this will just change the warnings from "not known to be
defined" to "not known to be defined at run-time". But if you need it
because the problematic function is actually a macro, then yes, this can
be the right thing to do (tho it won't necessarily fix your recursive
load).
> Seems that proper way to fix issue is by rearranging dependency hierarchy by
> breaking dependency cycles, isn't?
That's would be The Right Thing to do, yes.
> I think that I need to move shared definitions from xxx-mode.el into
> xxx-core.el:
That's one way, yes. Another is to move the shared definitions to one
of the two files (presumably to xxx-update since xxx-mode is the one
that should require the other).
Stefan
- Re: (require ...) and file dependencies.,
Stefan Monnier <=