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

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

Re: package not needed to byte-compile


From: Michael Heerdegen
Subject: Re: package not needed to byte-compile
Date: Mon, 23 Feb 2015 05:15:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

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.




reply via email to

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