all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex <agrambot@gmail.com>
To: emacs-devel@gnu.org
Subject: [PATCH] Extra information in autoload error
Date: Wed, 21 Sep 2016 14:53:52 -0600	[thread overview]
Message-ID: <87k2e5nfdr.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 138 bytes --]

I felt that the error that `autoload-do-load` throws when it runs into a
failed autoload is lacking, so I made the following adjustment:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: using Vload_history --]
[-- Type: text/x-diff, Size: 530 bytes --]

diff --git a/src/eval.c b/src/eval.c
index e08a25a..3c619ba 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1987,8 +1987,9 @@ it defines a macro.  */)
       Lisp_Object fun = Findirect_function (funname, Qnil);
 
       if (!NILP (Fequal (fun, fundef)))
-	error ("Autoloading failed to define function %s",
-	       SDATA (SYMBOL_NAME (funname)));
+	error ("Autoloading failed to define function %s in file %s",
+	       SDATA (SYMBOL_NAME (funname)),
+	       SDATA (Fcar (Fcar (Vload_history))));
       else
 	return fun;
     }

[-- Attachment #3: Type: text/plain, Size: 172 bytes --]




This should give the file that was checked for the autoload. I tested it
out and it seems to work. In case Vload_history can't be used, I also
tried out the following:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: patch using funname --]
[-- Type: text/x-diff, Size: 529 bytes --]

diff --git a/src/eval.c b/src/eval.c
index e08a25a..8a573de 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1987,8 +1987,9 @@ it defines a macro.  */)
       Lisp_Object fun = Findirect_function (funname, Qnil);
 
       if (!NILP (Fequal (fun, fundef)))
-	error ("Autoloading failed to define function %s",
-	       SDATA (SYMBOL_NAME (funname)));
+	error ("Autoloading failed to define function %s with filename %s",
+	       SDATA (SYMBOL_NAME (funname)),
+	       SDATA (Fcar (Fcdr (fundef))));
       else
 	return fun;
     }

[-- Attachment #5: Type: text/plain, Size: 120 bytes --]




Would one of these be considered for inclusion into Emacs? I think both
error messages are more helpful than before.

             reply	other threads:[~2016-09-21 20:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 20:53 Alex [this message]
2016-09-21 21:13 ` [PATCH] Extra information in autoload error Davis Herring
2016-09-21 22:16   ` Alex
2016-10-22 16:23     ` Alex
2016-10-22 16:30       ` Eli Zaretskii
2016-10-22 19:40       ` Stefan Monnier
2016-10-22 20:23         ` Alex
2016-10-23  5:53           ` Eli Zaretskii
2016-10-23 21:24             ` Alex
2016-10-24  6:30               ` Eli Zaretskii
2016-10-24 19:21                 ` Alex
2016-10-24 19:56                   ` Eli Zaretskii
2016-10-25  5:47                     ` Alex
2016-11-04  8:43                       ` 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=87k2e5nfdr.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=emacs-devel@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.