[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28994: 26.0.90; Build error during bootstrap
From: |
Stefan Monnier |
Subject: |
bug#28994: 26.0.90; Build error during bootstrap |
Date: |
Wed, 25 Oct 2017 11:37:58 -0400 |
Package: Emacs
Version: 26.0.90
The following:
rm -f src/bootstrap-emacs lisp/progmodes/elisp-mode.elc
make
triggers the following message:
[...]
Loading emacs-lisp/lisp-mode...
Loading .../lisp/progmodes/elisp-mode.el (source)...
Eager macro-expansion failure: (error "Autoloading file
.../lisp/emacs-lisp/regexp-opt.elc failed to define function flymake-log")
Loading textmodes/text-mode...
[...]
It's arguably harmless, but the error is undesirable and the error
message itself clearly shows we have a bug somewhere in our
error reporting.
I tracked down the source of the problem to:
- autoload-do-load (called to fetch flymake-log) will call `load` telling
it to silently ignore errors if flymake is not found.
- then, indeed, flymake.el isn't found (because lisp/progmodes is not in
load-path in this specific situation).
- so after the call to `load` the macro is still not defined and the
load-history has no trace of flymake.el since we didn't load it at all,
hence the odd error message.
The patch below to src/eval.c fixes this problem by:
- not signaling an error if the load didn't define the function when we
told load not to signal an error anyway (so we don't emit a misleading
message about some unrelated file).
- not telling load to ignore errors when we're trying to load a macro.
So after that patch, we get the real error message:
[...]
Loading emacs-lisp/lisp-mode...
Loading .../lisp/progmodes/elisp-mode.el (source)...
Eager macro-expansion failure: (file-missing "Cannot open load file" "Aucun
fichier ou dossier de ce type" "flymake")
Loading textmodes/text-mode...
[...]
Which I fix with the patch to lisp/loadup.el. This then bumps into
another error, because flymake.el ends up loading edmacro, which loads
kmacro which tries to modify query-replace-map which doesn't exist yet,
and if we fix that by loading `replace.el` we get yet another error because
`replace.el` tries to use text-mode-map which again isn't defined yet,
which I fix by loading text-mode.
And now it works without signaling an error. Any objection to
installing this patch, or suggestion to fix the string of problems some
other way?
Stefan
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 4abc571db4..5729f2fc8d 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -111,6 +111,7 @@
;;; Code:
;; Customization:
+(require 'replace)
(defgroup kmacro nil
"Simplified keyboard macro user interface."
diff --git a/lisp/loadup.el b/lisp/loadup.el
index d048f0736b..40e5651aa1 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -76,6 +76,7 @@
(setq max-lisp-eval-depth 2200)
(setq load-path (list (expand-file-name "." dir)
(expand-file-name "emacs-lisp" dir)
+ (expand-file-name "progmodes" dir)
(expand-file-name "language" dir)
(expand-file-name "international" dir)
(expand-file-name "textmodes" dir)
diff --git a/lisp/replace.el b/lisp/replace.el
index a5548f461d..cdaeb9240a 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -28,6 +28,7 @@
;;; Code:
+(require 'text-mode)
(eval-when-compile (require 'cl-lib))
(defcustom case-replace t
diff --git a/src/eval.c b/src/eval.c
index 52e4c96d4b..063deb4ba0 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1986,12 +1986,10 @@ it defines a macro. */)
if (!CONSP (fundef) || !EQ (Qautoload, XCAR (fundef)))
return fundef;
- if (EQ (macro_only, Qmacro))
- {
- Lisp_Object kind = Fnth (make_number (4), fundef);
- if (! (EQ (kind, Qt) || EQ (kind, Qmacro)))
- return fundef;
- }
+ Lisp_Object kind = Fnth (make_number (4), fundef);
+ if (EQ (macro_only, Qmacro)
+ && !(EQ (kind, Qt) || EQ (kind, Qmacro)))
+ return fundef;
/* This is to make sure that loadup.el gives a clear picture
of what files are preloaded and when. */
@@ -2014,15 +2012,18 @@ it defines a macro. */)
The value saved here is to be restored into Vautoload_queue. */
record_unwind_protect (un_autoload, Vautoload_queue);
Vautoload_queue = Qt;
- /* If `macro_only', assume this autoload to be a "best-effort",
+ /* If `macro_only' is set and fundef isn't a macro, assume this autoload to
+ be a "best-effort" (e.g. to try and find a compiler macro),
so don't signal an error if autoloading fails. */
- Fload (Fcar (Fcdr (fundef)), macro_only, Qt, Qnil, Qt);
+ Lisp_Object ignore_errors
+ = (EQ (kind, Qt) || EQ (kind, Qmacro)) ? Qnil : macro_only;
+ Fload (Fcar (Fcdr (fundef)), ignore_errors, Qt, Qnil, Qt);
/* Once loading finishes, don't undo it. */
Vautoload_queue = Qt;
unbind_to (count, Qnil);
- if (NILP (funname))
+ if (NILP (funname) || !NILP (ignore_errors))
return Qnil;
else
{
- bug#28994: 26.0.90; Build error during bootstrap,
Stefan Monnier <=