unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ralf Angeli <angeli@caeruleus.net>
To: Glenn Morris <rgm@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: declare-function from included file
Date: Wed, 19 Mar 2008 19:57:07 +0100	[thread overview]
Message-ID: <874pb2zgn0.fsf@photon.caeruleus.net> (raw)
In-Reply-To: <75y78fk08w.fsf@fencepost.gnu.org> (Glenn Morris's message of "Tue, 18 Mar 2008 20:47:59 -0400")

* 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	other threads:[~2008-03-19 18:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-16 18:23 declare-function from included file Ralf Angeli
2008-03-19  0:47 ` Glenn Morris
2008-03-19 18:57   ` Ralf Angeli [this message]
2008-03-19 19:30     ` Stefan Monnier
2008-03-19 20:32       ` Ralf Angeli
2008-03-19 20:42         ` Dan Nicolaescu
2008-03-19 21:00           ` Ralf Angeli
2008-03-19 21:19             ` Dan Nicolaescu
2008-03-19 21:45               ` Ralf Angeli
2008-03-19 22:18                 ` Dan Nicolaescu

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=874pb2zgn0.fsf@photon.caeruleus.net \
    --to=angeli@caeruleus.net \
    --cc=emacs-devel@gnu.org \
    --cc=rgm@gnu.org \
    /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).