emacs-devel
[Top][All Lists]
Advanced

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

Re: declare-function from included file


From: Ralf Angeli
Subject: Re: declare-function from included file
Date: Wed, 19 Mar 2008 19:57:07 +0100

* Glenn Morris (2008-03-19) writes:

> Ralf Angeli wrote:
>
>> is it possible to put calls to `declare-function' in a file to be
>> included during byte compilation?  The following does not seem not work:
>
> No, because by design declare-function only has an effect when being
> _compiled_, and you're not compiling the code in the included file.
> (At least, I think that explains it.)

Hm, this is what I suspected as well.

>> I can silence the byte compiler by using (fset 'bar (lambda (&rest
>>args) nil)) in include.el instead of the `declare-function' call.
>> Would this be a better alternative?
>
> That looks ugly to me, and could break loading of the non-compiled
> code.

Why is that?  Would the body of `eval-when-compile' be executed in this
case?  That's the only thing I can imagine causing trouble.

> Why not just put your declare-function statements in the right
> file? Though I guess the whole point of this is that you don't want
> to.

Yes, it clutters the file contents.  And the package -- we are talking
about RefTeX here -- is supposed to work with Emacs 21 and XEmacs as
well.  This means one would have to define `declare-function' in every
file it is used in case Emacs or XEmacs does not provide it.  This is
how it's done in Gnus at the moment and it looks quite clunky.  If the
`declare-function' statements where in a separate file, one could define
`declare-function' only once.

> Or live with the warnings.

Personally I'm not bothered too much by them but since we are talking
about code which is part of Emacs this is likely not an option.

-- 
Ralf




reply via email to

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