GNU bug report logs -
#26837
Wrong file in "autoloading failed to define" error
Previous Next
Reported by: Glenn Morris <rgm <at> gnu.org>
Date: Mon, 8 May 2017 19:15:02 UTC
Severity: minor
Found in version 26.0.50
Fixed in version 26.1
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #32 received at 26837 <at> debbugs.gnu.org (full text, mbox):
Glenn Morris <rgm <at> gnu.org> writes:
> Glenn Morris wrote:
>
> I think it was the lexical-binding thing. Following seems to work:
>
> --- i/src/lread.c
> +++ w/src/lread.c
> @@ -1885,7 +1885,7 @@ PREDICATE can also be an integer to pass to the faccessat(2) function,
> /* On the first cycle, we can easily test here
> whether we are reading the whole buffer. */
> if (b && first_sexp)
> - whole_buffer = (PT == BEG && ZV == Z);
> + whole_buffer = (BUF_PT (b) == BUF_BEG (b) && BUF_ZV (b) == BUF_Z (b));
>
> instream = stream;
> read_next:
> @@ -2008,6 +2008,7 @@ BUFFER is the buffer to evaluate (nil means use current buffer),
> record_unwind_protect (save_excursion_restore, save_excursion_save ());
> BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
> specbind (Qlexical_binding, lisp_file_lexically_bound_p (buf) ? Qt : Qnil);
> + BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
> readevalloop (buf, 0, filename,
> !NILP (printflag), unibyte, Qnil, Qnil, Qnil);
> unbind_to (count, Qnil);
That seems to work for me as well. Should it be documented that
reevaluations of a file update the position of the file in load-history?
I assumed this was already the case when making my autoload patch
because of the "history" in load-history, but documentation would help
to make that clear.
PS: I realized that I was a bit careless in using SDATA without checking
that the argument is necessarily a string. I don't think it matters much
if your above patch is applied, but it's probably not a good idea to
leave it in, just in case there's a bug somewhere else in the future.
What do you think about the following diff? This removes the dependency
on load-history altogether:
--- a/src/eval.c
+++ b/src/eval.c
@@ -2021,7 +2021,10 @@ it defines a macro. */)
if (!NILP (Fequal (fun, fundef)))
error ("Autoloading file %s failed to define function %s",
- SDATA (Fcar (Fcar (Vload_history))),
+ SDATA (Flocate_file_internal (Fcar (Fcdr (fundef)),
+ Vload_path,
+ Vload_suffixes,
+ Qnil)),
SDATA (SYMBOL_NAME (funname)));
else
return fun;
This bug report was last modified 8 years and 6 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.