Stefan Monnier <[EMAIL PROTECTED]> writes: [...]
> if I have function FOO autoloaded and (require 'blabla) replaces > that with some other definition, than an immediately following > (unload-feature 'blabla) should restore the autoload, no matter > whether the autoload was pointing to blabla.el or not. I have thought about this some more and there's more to it than just autoloads. What currently happens when you do (require 'blabla) and then (unload-feature 'blabla) is that all functions that "blabla" defined are unbound. Maybe not the right thing to do, but quite consistent. (There is only one case where (unload-feature 'blabla) will do anything else then fmakunbound a function that "blabla" defined and that is when a function was autoloaded and that function was defined when do_autoload loaded "blabla".) Consider the following situation: function 'a is autoloaded: (autoload "blabla" ...). function 'b is autoloaded: (autoload "other" ...). function 'c is defined. function 'd is unbound. "blabla" defines 'a, 'b, 'c, and 'd as functions. Do (require 'blabla) and then (unload-feature 'blabla). Currently, all four functions will be unbound by unload-feature. You propose to let unload-feature restore both 'a and 'b to their previous autoloads [1]. But what should be done with 'c? I think restoring 'c to its previous definition would be the right thing to do. But that would be quite a substantial change. It's probably best to leave this alone until after the release. Lute. [1] I have actually implemented this for Frequire; it's quite simple: Index: src/fns.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/fns.c,v retrieving revision 1.389 diff -c -r1.389 fns.c *** src/fns.c 22 Apr 2005 07:11:08 -0000 1.389 --- src/fns.c 24 Apr 2005 20:06:44 -0000 *************** *** 3482,3487 **** --- 3482,3488 ---- if (NILP (tem)) { + Lisp_Object first, second; int count = SPECPDL_INDEX (); int nesting = 0; *************** *** 3528,3533 **** --- 3529,3551 ---- error ("Required feature `%s' was not provided", SDATA (SYMBOL_NAME (feature))); + /* Save the old autoloads, in case we ever do an unload. */ + tem = Vautoload_queue; + while (CONSP (tem)) + { + first = XCAR (tem); + second = Fcdr (first); + first = Fcar (first); + + /* Note: This test is subtle. The cdr of an autoload-queue entry + may be an atom if the autoload entry was generated by a defalias + or fset. */ + if (CONSP (second)) + Fput (first, Qautoload, (XCDR (second))); + + tem = XCDR (tem); + } + /* Once loading finishes, don't undo it. */ Vautoload_queue = Qt; feature = unbind_to (count, feature); _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel