From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/60132 Path: news.gmane.org!not-for-mail From: Lute Kamstra Newsgroups: gmane.emacs.gnus.general,gmane.emacs.devel Subject: Re: require inside functions. Date: Sat, 09 Apr 2005 11:30:13 +0200 Message-ID: <87aco89u1m.fsf@xs4all.nl> References: <871x9w9dkn.fsf@xs4all.nl> <87mzsezu5f.fsf@xs4all.nl> <87hdimzou0.fsf@xs4all.nl> <87ll7uwy6m.fsf_-_@xs4all.nl> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1113039200 4474 80.91.229.2 (9 Apr 2005 09:33:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 9 Apr 2005 09:33:20 +0000 (UTC) Cc: storm@cua.dk (Kim F. Storm), reiner.steib@gmx.de, ding@gnus.org, emacs-devel@gnu.org, snogglethorpe@gmail.com, miles@gnu.org Original-X-From: ding-owner+M8659@lists.math.uh.edu Sat Apr 09 11:33:17 2005 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DKCL4-0006g8-Uq for ding-account@gmane.org; Sat, 09 Apr 2005 11:33:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1DKCIr-0004wl-00; Sat, 09 Apr 2005 04:30:57 -0500 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1DKCIk-0004wg-00 for ding@lists.math.uh.edu; Sat, 09 Apr 2005 04:30:50 -0500 Original-Received: from quimby.gnus.org ([80.91.224.244]) by util2.math.uh.edu with esmtp (Exim 4.30) id 1DKCIj-0001fR-Cf for ding@lists.math.uh.edu; Sat, 09 Apr 2005 04:30:49 -0500 Original-Received: from smtp-vbr15.xs4all.nl ([194.109.24.35]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1DKCIi-0004gZ-00 for ; Sat, 09 Apr 2005 11:30:48 +0200 Original-Received: from pijl (a80-127-67-124.adsl.xs4all.nl [80.127.67.124]) by smtp-vbr15.xs4all.nl (8.12.11/8.12.11) with ESMTP id j399UIkt011003; Sat, 9 Apr 2005 11:30:18 +0200 (CEST) (envelope-from Lute.Kamstra@xs4all.nl) Original-Received: from lute by pijl with local (Exim 3.36 #1 (Debian)) id 1DKCIE-0004fB-00; Sat, 09 Apr 2005 11:30:18 +0200 Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Fri, 08 Apr 2005 23:38:33 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Original-Lines: 65 X-Virus-Scanned: by XS4ALL Virus Scanner X-Spam-Score: -4.9 (----) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:60132 gmane.emacs.devel:35802 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:60132 Richard Stallman 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.