all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Subject: Re: package not needed to byte-compile
Date: Mon, 23 Feb 2015 05:15:59 +0100	[thread overview]
Message-ID: <877fv9i7pc.fsf@web.de> (raw)
In-Reply-To: 20150222190702.4e370c26@gauss

Joe Riel <joer@san.rr.com> writes:

> Is there a way to tell Emacs that package B is required to run package
> A, but not to compile package A?  Using (require B) causes an error
> during byte-compilation because the package is not necessarily
> available then.

I guess something like this, for example:

--8<---------------cut here---------------start------------->8---
(defun a-require-b ()
  (require 'b))

(a-require-b)
--8<---------------cut here---------------end--------------->8---

You can put a require call into any defun if you like (entry points to
code that makes use of B), that is not uncommon.  Of course A should not
make use of any macros defined in B.

If the whole B makes use of A's functions however, a toplevel require is
better.

If you avoid a toplevel require, you can use declare-function to get rid
of the compiler warnings about undefined functions.

Michael.




  parent reply	other threads:[~2015-02-23  4:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23  3:07 package not needed to byte-compile Joe Riel
2015-02-23  3:31 ` Joe Riel
2015-02-23  4:15 ` Michael Heerdegen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-02-23  2:57 Joe Riel
2015-02-23  4:00 ` Drew Adams
2015-02-23  4:35 ` Stefan Monnier
2015-02-23 23:11   ` Michael Heerdegen
2015-02-24  2:36     ` Stefan Monnier
2015-02-24  3:35       ` Michael Heerdegen

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

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

  git send-email \
    --in-reply-to=877fv9i7pc.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=help-gnu-emacs@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.