unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex <agrambot@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: [PATCH] Extra information in autoload error
Date: Mon, 24 Oct 2016 23:47:57 -0600	[thread overview]
Message-ID: <8737jlou7m.fsf@gmail.com> (raw)
In-Reply-To: <83lgxd34id.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 24 Oct 2016 22:56:26 +0300")

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

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex <agrambot@gmail.com>
>> Cc: monnier@iro.umontreal.ca,  emacs-devel@gnu.org
>> Date: Mon, 24 Oct 2016 13:21:08 -0600
>> 
>> Here, fundef is the autoload object. That is, it's a list of the form:
>> 
>>   (autoload filename docstring interactive type)
>> 
>> So SDATA (Fcar (Fcdr (fundef))) just gets the filename of the autoload
>> object. The filename of the autoload object is just the 2nd argument of
>> the `autoload' function.
>> 
>> So the Vload_history version returns the whole path, while the fundef
>> version just uses whatever was passed into autoload. Usually that is
>> just the filename sans extension, e.g.:
>> 
>> (symbol-function 'linum-mode) => (autoload "linum" 1174895 t nil)
>
> I think the file name alone will be enough.  Having a full absolute
> file name would be nicer, though.  I see no need for anything else:
> just the file name and the feature that was supposed to be autoloaded.
>
> Thanks.

Alright, I've attached a patch that includes both the absolute file name
and feature. If it's agreeable, then would you apply it for me?

Just to be clear, the autoload (autoload 'linum2 "linum") with this
patch will produce something like:

(error "Autoloading file /home/alex/emacs/lisp/linum.elc failed to
define function linum2")


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 856 bytes --]

From e8e8544b1805d474921974faa92d040699074878 Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Mon, 24 Oct 2016 23:20:54 -0600
Subject: [PATCH] Add extra information in autoload error

* src/eval.c (Fautoload_do_load): Include the absolute file name in the
  error.
---
 src/eval.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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


  reply	other threads:[~2016-10-25  5:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 20:53 [PATCH] Extra information in autoload error Alex
2016-09-21 21:13 ` 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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=8737jlou7m.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 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).