From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel 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) Message-ID: <75d35e8c-dfbf-4fe8-8850-2507369c9916@default> References: <87d1mzps99.fsf@web.de> <87wpl7ockh.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1467240160 26586 80.91.229.3 (29 Jun 2016 22:42:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 29 Jun 2016 22:42:40 +0000 (UTC) Cc: rswgnu@gmail.com, emacs-devel To: Michael Heerdegen , Robert Weiner Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 30 00:42:26 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bIOBc-000347-WE for ged-emacs-devel@m.gmane.org; Thu, 30 Jun 2016 00:42:25 +0200 Original-Received: from localhost ([::1]:46056 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIOBb-0001EG-PZ for ged-emacs-devel@m.gmane.org; Wed, 29 Jun 2016 18:42:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIOBQ-0001Bu-PC for emacs-devel@gnu.org; Wed, 29 Jun 2016 18:42:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIOBO-0002Ao-Nz for emacs-devel@gnu.org; Wed, 29 Jun 2016 18:42:11 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:41609) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIOBJ-0002AZ-Qn; Wed, 29 Jun 2016 18:42:06 -0400 Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u5TMg2j6010894 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 29 Jun 2016 22:42:03 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u5TMg2LV024110 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 29 Jun 2016 22:42:02 GMT Original-Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u5TMg1iW020830; Wed, 29 Jun 2016 22:42:01 GMT In-Reply-To: <87wpl7ockh.fsf@web.de> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6744.5000 (x86)] X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:204964 Archived-At: > > 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? >=20 > 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. >=20 > 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.