[Top][All Lists]

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

Re: Recursive compilation?

From: Stefan Monnier
Subject: Re: Recursive compilation?
Date: Tue, 31 May 2011 22:38:43 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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


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

reply via email to

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