all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* package not needed to byte-compile
@ 2015-02-23  2:57 Joe Riel
  2015-02-23  4:00 ` Drew Adams
  2015-02-23  4:35 ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Joe Riel @ 2015-02-23  2:57 UTC (permalink / raw)
  To: Help GNU Emacs

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 available then.

-- 
Joe Riel




^ permalink raw reply	[flat|nested] 9+ messages in thread

* package not needed to byte-compile
@ 2015-02-23  3:07 Joe Riel
  2015-02-23  3:31 ` Joe Riel
  2015-02-23  4:15 ` Michael Heerdegen
  0 siblings, 2 replies; 9+ messages in thread
From: Joe Riel @ 2015-02-23  3:07 UTC (permalink / raw)
  To: Help GNU Emacs

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.


-- 
Joe Riel




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: package not needed to byte-compile
  2015-02-23  3:07 Joe Riel
@ 2015-02-23  3:31 ` Joe Riel
  2015-02-23  4:15 ` Michael Heerdegen
  1 sibling, 0 replies; 9+ messages in thread
From: Joe Riel @ 2015-02-23  3:31 UTC (permalink / raw)
  To: Joe Riel; +Cc: Help GNU Emacs

On Sun, 22 Feb 2015 19:07:02 -0800
Joe Riel <joer@san.rr.com> wrote:

> 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.

Apologies for the duplication; I thought my first post
would be rejected because it came from an account
not registered with this group.


-- 
Joe Riel




^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: package not needed to byte-compile
  2015-02-23  2:57 package not needed to byte-compile Joe Riel
@ 2015-02-23  4:00 ` Drew Adams
  2015-02-23  4:35 ` Stefan Monnier
  1 sibling, 0 replies; 9+ messages in thread
From: Drew Adams @ 2015-02-23  4:00 UTC (permalink / raw)
  To: Joe Riel, Help GNU Emacs

> 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 available then.

It's not clear (to me) what you're asking.  `require' does not
byte-compile anything.  If A needs B then putting (require 'B)
in A loads B.  That compiles neither A nor B.

If you don't want to compile A, don't compile it.  Likewise, B.

Causes an error during byte compilation of what?  You said
that you do not want to compile A.  What error?

Your question is completely unclear to me.  I suggest that
you start over.  Tell us (a) what you did, specifically,
(b) what happened, specifically, including what error you
saw, and (c) what you expected to happen instead.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: package not needed to byte-compile
  2015-02-23  3:07 Joe Riel
  2015-02-23  3:31 ` Joe Riel
@ 2015-02-23  4:15 ` Michael Heerdegen
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Heerdegen @ 2015-02-23  4:15 UTC (permalink / raw)
  To: help-gnu-emacs

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.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: package not needed to byte-compile
  2015-02-23  2:57 package not needed to byte-compile Joe Riel
  2015-02-23  4:00 ` Drew Adams
@ 2015-02-23  4:35 ` Stefan Monnier
  2015-02-23 23:11   ` Michael Heerdegen
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2015-02-23  4:35 UTC (permalink / raw)
  To: help-gnu-emacs

> Using
> (require B)
> causes an error during byte-compilation because the
> package is not available then.

I've used

   (if t (require B))           ;Don't load during compilation.

when I needed that.


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: package not needed to byte-compile
  2015-02-23  4:35 ` Stefan Monnier
@ 2015-02-23 23:11   ` Michael Heerdegen
  2015-02-24  2:36     ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Heerdegen @ 2015-02-23 23:11 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>    (if t (require B))           ;Don't load during compilation.

The rule is that only top-level `require' occurrences are special and
cause files to be loaded when compiling, right?  Because, I can't find
that fact spelled out in the docs.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: package not needed to byte-compile
  2015-02-23 23:11   ` Michael Heerdegen
@ 2015-02-24  2:36     ` Stefan Monnier
  2015-02-24  3:35       ` Michael Heerdegen
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2015-02-24  2:36 UTC (permalink / raw)
  To: help-gnu-emacs

>> (if t (require B))           ;Don't load during compilation.
> The rule is that only top-level `require' occurrences are special and
> cause files to be loaded when compiling, right?

That's right.  Tho, "within a progn" or "within a macro which expands to
a progn" still counts as top-level.


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: package not needed to byte-compile
  2015-02-24  2:36     ` Stefan Monnier
@ 2015-02-24  3:35       ` Michael Heerdegen
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Heerdegen @ 2015-02-24  3:35 UTC (permalink / raw)
  To: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> >> (if t (require B))           ;Don't load during compilation.
> > The rule is that only top-level `require' occurrences are special and
> > cause files to be loaded when compiling, right?
>
> That's right.  Tho, "within a progn" or "within a macro which expands to
> a progn" still counts as top-level.

Good to know, thanks.

I now also found out where it is described in the docs: it's discussed
in (info "(elisp) Named Features").




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-02-24  3:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-23  2:57 package not needed to byte-compile 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
  -- strict thread matches above, loose matches on Subject: below --
2015-02-23  3:07 Joe Riel
2015-02-23  3:31 ` Joe Riel
2015-02-23  4:15 ` Michael Heerdegen

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.