From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Recursive compilation? Date: Tue, 31 May 2011 22:38:43 -0300 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1306892355 28652 80.91.229.12 (1 Jun 2011 01:39:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 1 Jun 2011 01:39:15 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 01 03:39:11 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QRaOr-0000Pl-Kl for ged-emacs-devel@m.gmane.org; Wed, 01 Jun 2011 03:39:09 +0200 Original-Received: from localhost ([::1]:34791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRaOp-00051H-VU for ged-emacs-devel@m.gmane.org; Tue, 31 May 2011 21:39:08 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:49978) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRaOV-00050t-O9 for emacs-devel@gnu.org; Tue, 31 May 2011 21:38:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QRaOU-0007Fp-A9 for emacs-devel@gnu.org; Tue, 31 May 2011 21:38:47 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:59213) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRaOU-0007Fl-8d for emacs-devel@gnu.org; Tue, 31 May 2011 21:38:46 -0400 Original-Received: from 121-249-126-200.fibertel.com.ar ([200.126.249.121]:4788 helo=ceviche.home) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1QRaOT-0000ui-Sn; Tue, 31 May 2011 21:38:46 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 15524660DD; Tue, 31 May 2011 22:38:43 -0300 (ART) In-Reply-To: (Lars Magne Ingebrigtsen's message of "Wed, 01 Jun 2011 00:17:03 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:140009 Archived-At: >> I'm personally using a different hack which doesn't solve all those >> problems either but is simple and doesn't suffer from as many problems >> in my experience: prefer loading the .el file if it's more recent. > I was thinking that perhaps if file a.el requires a macro from b.el, and > b.el isn't compiled, then a.elc would end up in a somewhat less compiled > state than it otherwise would? When a.el calls an inlinable function from b.el, then the result will indeed be different (even tho in both cases the function will be inlined), yet in most cases it shouldn't make much of a difference. > But if that's not the case, then perhaps `require', when run via > `byte-compile-file', should just always load the .el file if it's more > recent? That certainly sounds easy enough to implement -- > `byte-compile-file' could just bind a variable to signal that it wanted > this behaviour. I use the patch below, Stefan === modified file 'lisp/emacs-lisp/bytecomp.el' --- lisp/emacs-lisp/bytecomp.el 2011-05-30 17:14:19 +0000 +++ lisp/emacs-lisp/bytecomp.el 2011-05-31 20:48:24 +0000 @@ -1713,6 +1720,12 @@ (setq byte-compile-last-logged-file nil) (let ((byte-compile-current-file filename) (byte-compile-current-group nil) + ;; Prefer source files over compiled files. This is so that when + ;; several files are changed and recompiled, each new file is + ;; properly recompiled with the new macros in the other new files. + (load-suffixes (sort (copy-sequence load-suffixes) + (lambda (s1 s2) (and (string-match "\\.elc\\b" s2) + (string-match "\\.el\\b" s1))))) (set-auto-coding-for-load t) target-file input-buffer output-buffer byte-compile-dest-file)