all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: 28994@debbugs.gnu.org
Subject: bug#28994: 26.0.90; Build error during bootstrap
Date: Wed, 25 Oct 2017 11:37:58 -0400	[thread overview]
Message-ID: <jwvmv4fs0fd.fsf@iro.umontreal.ca> (raw)

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
     {





             reply	other threads:[~2017-10-25 15:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-25 15:37 Stefan Monnier [this message]
2017-10-25 16:09 ` bug#28994: 26.0.90; Build error during bootstrap 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvmv4fs0fd.fsf@iro.umontreal.ca \
    --to=monnier@iro.umontreal.ca \
    --cc=28994@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.