From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lute Kamstra Newsgroups: gmane.emacs.devel Subject: Re: Removing unloaded functions from auto-mode-alist. Date: Sun, 24 Apr 2005 22:24:43 +0200 Message-ID: <874qdvc48k.fsf@xs4all.nl> References: <87zmvu6ba2.fsf@xs4all.nl> <85ll7e68ei.fsf@lola.goethe.zz> <854qe2ihhi.fsf@lola.goethe.zz> <85oecagzwf.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1114374515 9060 80.91.229.2 (24 Apr 2005 20:28:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 24 Apr 2005 20:28:35 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 24 22:28:30 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DPni7-0003xa-41 for ged-emacs-devel@m.gmane.org; Sun, 24 Apr 2005 22:28:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DPnnU-0002wz-NN for ged-emacs-devel@m.gmane.org; Sun, 24 Apr 2005 16:33:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DPnkx-0001o7-LC for emacs-devel@gnu.org; Sun, 24 Apr 2005 16:31:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DPnkw-0001np-MX for emacs-devel@gnu.org; Sun, 24 Apr 2005 16:31:07 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DPnkw-0001Un-HJ for emacs-devel@gnu.org; Sun, 24 Apr 2005 16:31:06 -0400 Original-Received: from [194.109.24.29] (helo=smtp-vbr9.xs4all.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DPnhx-0002XU-Fz; Sun, 24 Apr 2005 16:28:01 -0400 Original-Received: from pijl (a80-127-67-124.adsl.xs4all.nl [80.127.67.124]) by smtp-vbr9.xs4all.nl (8.12.11/8.12.11) with ESMTP id j3OKOhb6043236; Sun, 24 Apr 2005 22:24:43 +0200 (CEST) (envelope-from Lute.Kamstra@xs4all.nl) Original-Received: from lute by pijl with local (Exim 3.36 #1 (Debian)) id 1DPnel-0001fo-00; Sun, 24 Apr 2005 22:24:43 +0200 Original-To: Stefan Monnier In-Reply-To: (Stefan Monnier's message of "Wed, 20 Apr 2005 14:52:20 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Original-Lines: 89 X-Virus-Scanned: by XS4ALL Virus Scanner X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:36338 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36338 Stefan Monnier 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);