emacs-diffs
[Top][All Lists]
Advanced

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

feature/native-comp 87b9c3e 4/6: Have .elc files in `load-history' when


From: Andrea Corallo
Subject: feature/native-comp 87b9c3e 4/6: Have .elc files in `load-history' when loading native code (bug#43089)
Date: Sat, 29 Aug 2020 10:20:50 -0400 (EDT)

branch: feature/native-comp
commit 87b9c3e71840f480c2ce05eb51d71156790a5434
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>

    Have .elc files in `load-history' when loading native code (bug#43089)
    
        * src/lread.c (Fload): Add the corresponding .elc file to
        `load-history' when loading native code.
    
        * lisp/subr.el (eval-after-load): Use `load-file-name' instead of
        `load-true-file-name'.
---
 lisp/subr.el |  4 ++--
 src/lread.c  | 24 +++++++++++++++---------
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 6e86601..b020d09 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4613,10 +4613,10 @@ This function makes or adds to an entry on 
`after-load-alist'."
                ;; So add an indirection to make sure that `func' is really run
                ;; "after-load" in case the provide call happens early.
                (lambda ()
-                 (if (not load-true-file-name)
+                 (if (not load-file-name)
                      ;; Not being provided from a file, run func right now.
                      (funcall func)
-                   (let ((lfn load-true-file-name)
+                   (let ((lfn load-file-name)
                          ;; Don't use letrec, because equal (in
                          ;; add/remove-hook) would get trapped in a cycle.
                          (fun (make-symbol "eval-after-load-helper")))
diff --git a/src/lread.c b/src/lread.c
index 326af30..ac5b283 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1322,10 +1322,23 @@ Return t if the file exists and loads successfully.  */)
   specbind (Qlexical_binding, Qnil);
 
   /* Get the name for load-history.  */
+  Lisp_Object found_for_hist;
+  if (is_native_elisp)
+    {
+      /* Reconstruct the .elc filename.  */
+      Lisp_Object src_name = Fgethash (Ffile_name_nondirectory (found),
+                                      Vcomp_eln_to_el_h, Qnil);
+      if (suffix_p (src_name, "el.gz"))
+       src_name = Fsubstring (src_name, make_fixnum (0), make_fixnum (-3));
+      found_for_hist = concat2 (src_name, build_string ("c"));
+    }
+  else
+    found_for_hist = found;
+
   hist_file_name = (! NILP (Vpurify_flag)
                     ? concat2 (Ffile_name_directory (file),
-                               Ffile_name_nondirectory (found))
-                    : found) ;
+                               Ffile_name_nondirectory (found_for_hist))
+                    : found_for_hist);
 
   version = -1;
 
@@ -1504,13 +1517,6 @@ Return t if the file exists and loads successfully.  */)
     {
 #ifdef HAVE_NATIVE_COMP
       specbind (Qcurrent_load_list, Qnil);
-      if (!NILP (Vpurify_flag))
-       {
-         Lisp_Object base = concat2 (parent_directory (Vinvocation_directory),
-                                     build_string ("lisp/"));
-         Lisp_Object offset = Flength (base);
-         hist_file_name = Fsubstring (found, offset, Qnil);
-       }
       LOADHIST_ATTACH (hist_file_name);
       Fnative_elisp_load (found, Qnil);
       build_load_history (hist_file_name, true);



reply via email to

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