all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Michael Heerdegen <michael_heerdegen@web.de>,
	Robert Weiner <rsw@gnu.org>
Cc: rswgnu@gmail.com, emacs-devel <emacs-devel@gnu.org>
Subject: RE: Emacs 25.0.94: Is require failing to define macros and functions at compile time?
Date: Wed, 29 Jun 2016 15:42:00 -0700 (PDT)	[thread overview]
Message-ID: <75d35e8c-dfbf-4fe8-8850-2507369c9916@default> (raw)
In-Reply-To: <87wpl7ockh.fsf@web.de>

> > Is there a way to have it load the .el version of the file first and
> > then byte-compile it if that is what I want?
> 
> Sure (there is always a way in Emacs...), but I don't think it's a good
> idea to use such a hack just for a more cosmetic purpose.
> 
> IIRC the currently compiled file can be referred to with the variable
> `byte-compile-current-file', even from the file itself.  I don't recall
> the downsides of loading the file while compiling (apart from making
> compiling slow and loading the package unnecessarily when compiling).

From (elisp) `Named Features':

   When 'require' is used at top level in a file, it takes effect when
 you byte-compile that file (*note Byte Compilation::) as well as when
 you load it.  This is in case the required package contains macros that
 the byte compiler must know about.  It also avoids byte compiler
 warnings for functions and variables defined in the file loaded with
 'require'.

   Although top-level calls to 'require' are evaluated during byte
 compilation, 'provide' calls are not.  Therefore, you can ensure that a
 file of definitions is loaded before it is byte-compiled by including a
 'provide' followed by a 'require' for the same feature, as in the
 following example.

     (provide 'my-feature)  ; Ignored by byte compiler,
                            ;   evaluated by 'load'.
     (require 'my-feature)  ; Evaluated by byte compiler.

 The compiler ignores the 'provide', then processes the 'require' by
 loading the file in question.  Loading the file does execute the
 'provide' call, so the subsequent 'require' call does nothing when the
 file is loaded.



  reply	other threads:[~2016-06-29 22:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29 14:55 Emacs 25.0.94: Is require failing to define macros and functions at compile time? Robert Weiner
2016-06-29 15:14 ` Clément Pit--Claudel
2016-06-29 15:44   ` Robert Weiner
2016-06-29 19:06     ` Davis Herring
2016-06-29 19:59       ` Drew Adams
2016-06-29 20:34         ` Robert Weiner
2016-06-29 20:59           ` Drew Adams
2016-06-29 21:04           ` John Mastro
2016-06-30  0:09           ` Herring, Davis
2016-06-30  5:56             ` Robert Weiner
2016-06-29 15:16 ` Drew Adams
2016-06-29 22:03   ` Michael Heerdegen
2016-06-29 22:09     ` Robert Weiner
2016-06-29 22:27       ` Michael Heerdegen
2016-06-29 22:42         ` Drew Adams [this message]
2016-06-29 23:14           ` Robert Weiner
2016-06-29 22:07 ` 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=75d35e8c-dfbf-4fe8-8850-2507369c9916@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=rsw@gnu.org \
    --cc=rswgnu@gmail.com \
    /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.