unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#28994: 26.0.90; Build error during bootstrap
@ 2017-10-25 15:37 Stefan Monnier
  2017-10-25 16:09 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2017-10-25 15:37 UTC (permalink / raw)
  To: 28994

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
     {





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#28994: 26.0.90; Build error during bootstrap
  2017-10-25 15:37 bug#28994: 26.0.90; Build error during bootstrap Stefan Monnier
@ 2017-10-25 16:09 ` Eli Zaretskii
  2017-10-25 16:17   ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2017-10-25 16:09 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 28994

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Date: Wed, 25 Oct 2017 11:37:58 -0400
> 
> Any objection to installing this patch

None if you meant to install on master.

Thanks.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#28994: 26.0.90; Build error during bootstrap
  2017-10-25 16:09 ` Eli Zaretskii
@ 2017-10-25 16:17   ` Stefan Monnier
  2017-10-25 16:25     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2017-10-25 16:17 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 28994

>> Any objection to installing this patch
> None if you meant to install on master.

OK.  And would there be some part you'd be willing/interested to see on
emacs-26?


        Stefan





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#28994: 26.0.90; Build error during bootstrap
  2017-10-25 16:17   ` Stefan Monnier
@ 2017-10-25 16:25     ` Eli Zaretskii
  2017-10-25 16:38       ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2017-10-25 16:25 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 28994

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: 28994@debbugs.gnu.org
> Date: Wed, 25 Oct 2017 12:17:29 -0400
> 
> >> Any objection to installing this patch
> > None if you meant to install on master.
> 
> OK.  And would there be some part you'd be willing/interested to see on
> emacs-26?

The Lisp parts look innocent enough.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#28994: 26.0.90; Build error during bootstrap
  2017-10-25 16:25     ` Eli Zaretskii
@ 2017-10-25 16:38       ` Stefan Monnier
  2017-10-25 17:33         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2017-10-25 16:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 28994-done

>> >> Any objection to installing this patch
>> > None if you meant to install on master.
>> OK.  And would there be some part you'd be willing/interested to see on
>> emacs-26?
> The Lisp parts look innocent enough.

OK, done, thanks,


        Stefan





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#28994: 26.0.90; Build error during bootstrap
  2017-10-25 16:38       ` Stefan Monnier
@ 2017-10-25 17:33         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2017-10-25 17:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 28994

> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Cc: 28994-done@debbugs.gnu.org
> Date: Wed, 25 Oct 2017 12:38:29 -0400
> 
> >> >> Any objection to installing this patch
> >> > None if you meant to install on master.
> >> OK.  And would there be some part you'd be willing/interested to see on
> >> emacs-26?
> > The Lisp parts look innocent enough.
> 
> OK, done, thanks,

Thank you.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-25 17:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-25 15:37 bug#28994: 26.0.90; Build error during bootstrap Stefan Monnier
2017-10-25 16:09 ` Eli Zaretskii
2017-10-25 16:17   ` Stefan Monnier
2017-10-25 16:25     ` Eli Zaretskii
2017-10-25 16:38       ` Stefan Monnier
2017-10-25 17:33         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).