From: Lute Kamstra <Lute.Kamstra.lists@xs4all.nl>
Cc: emacs-devel@gnu.org
Subject: Re: Removing unloaded functions from auto-mode-alist.
Date: Sun, 24 Apr 2005 22:24:43 +0200 [thread overview]
Message-ID: <874qdvc48k.fsf@xs4all.nl> (raw)
In-Reply-To: <jwvfyxls313.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 20 Apr 2005 14:52:20 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> 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);
next prev parent reply other threads:[~2005-04-24 20:24 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-19 15:23 Removing unloaded functions from auto-mode-alist Lute Kamstra
2005-04-19 16:25 ` David Kastrup
2005-04-19 17:44 ` Stefan Monnier
2005-04-19 21:28 ` David Kastrup
2005-04-19 21:58 ` Stefan Monnier
2005-04-19 22:33 ` David Kastrup
2005-04-20 18:52 ` Stefan Monnier
2005-04-24 20:24 ` Lute Kamstra [this message]
2005-04-24 20:50 ` David Kastrup
2005-04-24 21:51 ` Lute Kamstra
2005-04-24 22:00 ` David Kastrup
2005-04-24 23:37 ` Lute Kamstra
2005-04-25 0:07 ` David Kastrup
2005-04-26 10:04 ` Richard Stallman
2005-04-20 19:22 ` Lute Kamstra
2005-04-19 23:01 ` Stefan Monnier
2005-04-19 23:14 ` Lute Kamstra
2005-04-19 23:24 ` David Kastrup
2005-04-20 18:41 ` Stefan Monnier
2005-04-20 19:00 ` David Kastrup
2005-04-20 19:18 ` Stefan Monnier
2005-04-20 19:50 ` David Kastrup
2005-04-20 19:29 ` Lute Kamstra
2005-04-20 14:57 ` Richard Stallman
2005-04-20 15:59 ` Lute Kamstra
2005-04-21 15:30 ` Richard Stallman
2005-04-21 16:35 ` Lute Kamstra
2005-04-22 20:51 ` David Kastrup
2005-04-23 21:00 ` Lute Kamstra
2005-04-23 22:10 ` David Kastrup
2005-04-24 20:21 ` Lute Kamstra
2005-04-24 20:32 ` David Kastrup
2005-04-24 20:52 ` Lute Kamstra
2005-04-25 16:05 ` Richard Stallman
2005-04-23 22:24 ` Richard Stallman
2005-04-20 14:57 ` Richard Stallman
2005-04-20 15:02 ` Stefan Monnier
2005-04-20 15:57 ` David Kastrup
2005-04-20 18:37 ` Stefan Monnier
2005-04-20 19:19 ` David Kastrup
2005-04-20 20:11 ` Stefan Monnier
2005-04-20 20:25 ` David Kastrup
2005-04-20 20:57 ` Stefan Monnier
2005-04-20 21:33 ` David Kastrup
2005-04-20 16:25 ` Andreas Schwab
2005-04-20 16:57 ` David Kastrup
2005-04-20 22:47 ` Andreas Schwab
2005-04-20 22:58 ` David Kastrup
2005-04-21 9:56 ` Andreas Schwab
2005-04-21 10:12 ` David Kastrup
2005-04-21 11:50 ` Andreas Schwab
2005-04-21 19:56 ` Richard Stallman
2005-04-21 20:13 ` David Kastrup
2005-04-23 16:15 ` Richard Stallman
2005-04-23 16:23 ` David Kastrup
2005-04-23 16:15 ` Richard Stallman
2005-04-21 11:41 ` Johan Vromans
2005-04-20 15:43 ` David Kastrup
2005-04-21 15:30 ` Richard Stallman
2005-04-21 17:46 ` David Kastrup
2005-04-23 16:15 ` Richard Stallman
2005-04-19 22:00 ` Lute Kamstra
2005-04-19 23:22 ` Andreas Schwab
2005-04-19 23:33 ` David Kastrup
2005-04-19 21:05 ` Lute Kamstra
2005-04-20 14:57 ` Richard Stallman
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=874qdvc48k.fsf@xs4all.nl \
--to=lute.kamstra.lists@xs4all.nl \
--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 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).