emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master cc113e5: Fix test for whether the '.el' file is new


From: Eli Zaretskii
Subject: [Emacs-diffs] master cc113e5: Fix test for whether the '.el' file is newer than '.elc'
Date: Wed, 22 Jun 2016 15:57:52 +0000 (UTC)

branch: master
commit cc113e557d56d849e9699ceb3bc4a735c628b46e
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix test for whether the '.el' file is newer than '.elc'
    
    * src/lread.c (Fload): Don't overwrite the last character of the
    file name in FOUND with 'c', unless the file name ended in ".elc"
    to begin with.  Don't treat empty files as byte-compiled.  See
    http://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00463.html
    for more details of the problem this caused.
---
 src/lread.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/lread.c b/src/lread.c
index 9f804ac..5c47f78 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1204,7 +1204,11 @@ Return t if the file exists and loads successfully.  */)
   specbind (Qold_style_backquotes, Qnil);
   record_unwind_protect (load_warn_old_style_backquotes, file);
 
-  if (suffix_p (found, ".elc") || (fd >= 0 && (version = safe_to_load_version 
(fd)) > 0))
+  int is_elc;
+  if ((is_elc = suffix_p (found, ".elc")) != 0
+      /* version = 1 means the file is empty, in which case we can
+        treat it as not byte-compiled.  */
+      || (fd >= 0 && (version = safe_to_load_version (fd)) > 1))
     /* Load .elc files directly, but not when they are
        remote and have no handler!  */
     {
@@ -1231,7 +1235,7 @@ Return t if the file exists and loads successfully.  */)
           /* openp already checked for newness, no point doing it again.
              FIXME would be nice to get a message when openp
              ignores suffix order due to load_prefer_newer.  */
-          if (!load_prefer_newer)
+          if (!load_prefer_newer && is_elc)
             {
               result = stat (SSDATA (efound), &s1);
               if (result == 0)



reply via email to

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