]> git.eshelyaron.com Git - emacs.git/commitdiff
Issue a warning when eln look-up fails due to missing .el source file.
authorAndrea Corallo <akrl@sdf.org>
Thu, 1 Apr 2021 12:27:12 +0000 (14:27 +0200)
committerAndrea Corallo <akrl@sdf.org>
Thu, 1 Apr 2021 19:49:38 +0000 (21:49 +0200)
* lisp/emacs-lisp/comp.el (comp-warning-on-missing-source): New
customize.
* src/lread.c (maybe_swap_for_eln): Issue a warning when eln
look-up fails due to missing .el source file.
* src/comp.c (syms_of_comp): Define
'Qcomp_warning_on_missing_source'.

lisp/emacs-lisp/comp.el
src/comp.c
src/lread.c

index 213eb7b4126e1a05c56e7ab187161ae8d9a5389e..7f41a97f6b998909680f9d5e79c9298de32f80ca 100644 (file)
@@ -180,6 +180,13 @@ the .eln output directory."
   :type 'boolean
   :version "28.1")
 
+(defcustom comp-warning-on-missing-source t
+  "Emit a warning if a byte-code file being loaded has no corresponding source.
+The source file is necessary for native code file look-up and deferred
+compilation mechanism."
+  :type 'boolean
+  :version "28.1")
+
 (defvar no-native-compile nil
   "Non-nil to prevent native-compiling of Emacs Lisp code.
 Note that when `no-byte-compile' is set to non-nil it overrides the value of
index eb734d5833d083f1da7af0aa51f2ccfa97fc91f3..67c8e39315b10debec6290bb01a56cd2d0ab4469 100644 (file)
@@ -5254,7 +5254,8 @@ compiled one.  */);
   DEFSYM (Qlate, "late");
   DEFSYM (Qlambda_fixup, "lambda-fixup");
   DEFSYM (Qgccjit, "gccjit");
-  DEFSYM (Qcomp_subr_trampoline_install, "comp-subr-trampoline-install")
+  DEFSYM (Qcomp_subr_trampoline_install, "comp-subr-trampoline-install");
+  DEFSYM (Qcomp_warning_on_missing_source, "comp-warning-on-missing-source");
 
   /* To be signaled by the compiler.  */
   DEFSYM (Qnative_compiler_error, "native-compiler-error");
index ec6f09238bad410fc3847db31aaf99a512a8e697..156df73de8236af5e680e7455470812ee40f83b5 100644 (file)
@@ -1674,8 +1674,16 @@ maybe_swap_for_eln (bool no_native, Lisp_Object *filename, int *fd,
     {
       src_name = concat2 (src_name, build_string (".gz"));
       if (NILP (Ffile_exists_p (src_name)))
-       /* Can't find the corresponding source file.  */
-       return;
+       {
+         if (!NILP (find_symbol_value (Qcomp_warning_on_missing_source)))
+           call2 (intern_c_string ("display-warning"),
+                  Qcomp,
+                  CALLN (Fformat,
+                         build_string ("Cannot look-up eln file as no source "
+                                       "file was found for %s"),
+                         *filename));
+         return;
+       }
     }
   Lisp_Object eln_rel_name = Fcomp_el_to_eln_rel_filename (src_name);