[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: require inside functions.
From: |
Lute Kamstra |
Subject: |
Re: require inside functions. |
Date: |
Sat, 09 Apr 2005 11:30:13 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Richard Stallman <address@hidden> writes:
> It is not _file_ foo, but _function_ foo that did (require 'bar).
>
> Why is it useful to record that? For what purpose?
>
> It isn't particularly useful, but it is hard to avoid.
> Frequire does the same things, whether `require' was called
> from a Lisp function or from code at top level in a file.
>
> However, my change turns off recording in the case where
> no file is being loaded.
>
> Does this give good results?
>
> *** fns.c 18 Jan 2005 19:52:01 -0500 1.382
> --- fns.c 08 Apr 2005 22:22:22 -0400
> ***************
> *** 66,71 ****
> --- 66,72 ----
> extern int minibuffer_auto_raise;
> extern Lisp_Object minibuf_window;
> extern Lisp_Object Vlocale_coding_system;
> + extern Lisp_Object Vloads_in_progress;
>
> Lisp_Object Qstring_lessp, Qprovide, Qrequire;
> Lisp_Object Qyes_or_no_p_history;
Vloads_in_progress currently has internal linkage in lread.c.
> ***************
> *** 3444,3452 ****
> CHECK_SYMBOL (feature);
>
> /* Record the presence of `require' in this file
> ! even if the feature specified is already loaded. */
> ! LOADHIST_ATTACH (Fcons (Qrequire, feature));
> !
> tem = Fmemq (feature, Vfeatures);
>
> if (NILP (tem))
> --- 3445,3459 ----
> CHECK_SYMBOL (feature);
>
> /* Record the presence of `require' in this file
> ! even if the feature specified is already loaded.
> ! But not more than once in any file,
> ! and not when we aren't loading a file. */
> ! if (! NILP (Vloads_in_progress))
> ! {
> ! tem = Fcons (Qrequire, feature);
> ! if (NILP (Fmember (tem, Vcurrent_load_list)))
> ! LOADHIST_ATTACH (tem);
> ! }
> tem = Fmemq (feature, Vfeatures);
>
> if (NILP (tem))
For the rest, the patch works fine in the sense that (1)
current-load-list does not grow anymore during a normal Emacs run and
(2) require is as fast as featurep in case the feature is already
loaded. But I don't know the internals of the load process, so I
can't say if the patch breaks anything there.
Lute.
- require inside functions. (was: Changes in calendar/time-date.el), (continued)
- require inside functions. (was: Changes in calendar/time-date.el), Lute Kamstra, 2005/04/07
- Re: require inside functions. (was: Changes in calendar/time-date.el), Kim F. Storm, 2005/04/07
- Re: require inside functions., Stefan Monnier, 2005/04/07
- Re: require inside functions., Miles Bader, 2005/04/07
- Re: require inside functions., Stefan Monnier, 2005/04/07
- Re: require inside functions., Miles Bader, 2005/04/07
- Re: require inside functions. (was: Changes in calendar/time-date.el), Richard Stallman, 2005/04/07
- Re: require inside functions., David Kastrup, 2005/04/08
- Re: require inside functions. (was: Changes in calendar/time-date.el), Kim F. Storm, 2005/04/08
- Re: require inside functions. (was: Changes in calendar/time-date.el), Richard Stallman, 2005/04/08
- Re: require inside functions.,
Lute Kamstra <=
- Re: require inside functions., Richard Stallman, 2005/04/09
- Re: require inside functions., Lute Kamstra, 2005/04/13
- Re: require inside functions., Richard Stallman, 2005/04/14
- Re: require inside functions., Lute Kamstra, 2005/04/15
- Re: Changes in calendar/time-date.el, Lute Kamstra, 2005/04/05