aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2021-04-01 14:27:12 +0200
committerAndrea Corallo2021-04-01 21:49:38 +0200
commitdc393517ca1cfef7770bffdfe2b7fd3c2c5e7bbf (patch)
treefda89f0efa7a4024ebb091a01d7b9e70075dde3c
parent8d550700c535dbcd4721cc65c0a11decbf070abb (diff)
downloademacs-dc393517ca1cfef7770bffdfe2b7fd3c2c5e7bbf.tar.gz
emacs-dc393517ca1cfef7770bffdfe2b7fd3c2c5e7bbf.zip
Issue a warning when eln look-up fails due to missing .el source file.
* 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'.
-rw-r--r--lisp/emacs-lisp/comp.el7
-rw-r--r--src/comp.c3
-rw-r--r--src/lread.c12
3 files changed, 19 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 213eb7b4126..7f41a97f6b9 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -180,6 +180,13 @@ the .eln output directory."
180 :type 'boolean 180 :type 'boolean
181 :version "28.1") 181 :version "28.1")
182 182
183(defcustom comp-warning-on-missing-source t
184 "Emit a warning if a byte-code file being loaded has no corresponding source.
185The source file is necessary for native code file look-up and deferred
186compilation mechanism."
187 :type 'boolean
188 :version "28.1")
189
183(defvar no-native-compile nil 190(defvar no-native-compile nil
184 "Non-nil to prevent native-compiling of Emacs Lisp code. 191 "Non-nil to prevent native-compiling of Emacs Lisp code.
185Note that when `no-byte-compile' is set to non-nil it overrides the value of 192Note that when `no-byte-compile' is set to non-nil it overrides the value of
diff --git a/src/comp.c b/src/comp.c
index eb734d5833d..67c8e39315b 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -5254,7 +5254,8 @@ compiled one. */);
5254 DEFSYM (Qlate, "late"); 5254 DEFSYM (Qlate, "late");
5255 DEFSYM (Qlambda_fixup, "lambda-fixup"); 5255 DEFSYM (Qlambda_fixup, "lambda-fixup");
5256 DEFSYM (Qgccjit, "gccjit"); 5256 DEFSYM (Qgccjit, "gccjit");
5257 DEFSYM (Qcomp_subr_trampoline_install, "comp-subr-trampoline-install") 5257 DEFSYM (Qcomp_subr_trampoline_install, "comp-subr-trampoline-install");
5258 DEFSYM (Qcomp_warning_on_missing_source, "comp-warning-on-missing-source");
5258 5259
5259 /* To be signaled by the compiler. */ 5260 /* To be signaled by the compiler. */
5260 DEFSYM (Qnative_compiler_error, "native-compiler-error"); 5261 DEFSYM (Qnative_compiler_error, "native-compiler-error");
diff --git a/src/lread.c b/src/lread.c
index ec6f09238ba..156df73de82 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1674,8 +1674,16 @@ maybe_swap_for_eln (bool no_native, Lisp_Object *filename, int *fd,
1674 { 1674 {
1675 src_name = concat2 (src_name, build_string (".gz")); 1675 src_name = concat2 (src_name, build_string (".gz"));
1676 if (NILP (Ffile_exists_p (src_name))) 1676 if (NILP (Ffile_exists_p (src_name)))
1677 /* Can't find the corresponding source file. */ 1677 {
1678 return; 1678 if (!NILP (find_symbol_value (Qcomp_warning_on_missing_source)))
1679 call2 (intern_c_string ("display-warning"),
1680 Qcomp,
1681 CALLN (Fformat,
1682 build_string ("Cannot look-up eln file as no source "
1683 "file was found for %s"),
1684 *filename));
1685 return;
1686 }
1679 } 1687 }
1680 Lisp_Object eln_rel_name = Fcomp_el_to_eln_rel_filename (src_name); 1688 Lisp_Object eln_rel_name = Fcomp_el_to_eln_rel_filename (src_name);
1681 1689