From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Todd Newsgroups: gmane.lisp.guile.devel Subject: Re: -I for guile command line Date: Sun, 15 Aug 2004 18:18:46 -0500 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <7587CDB5-EF11-11D8-BD8D-000A95CD5044@mac.com> References: <0CB8AB8A-CBC8-11D8-A9B1-000A95CD5044@mac.com> <87llggay8m.fsf@zagadka.ping.de> <1DE1E084-EF03-11D8-BD8D-000A95CD5044@mac.com> <4594ABAD-EF11-11D8-BD8D-000A95CD5044@mac.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 (Apple Message framework v619) Content-Type: multipart/mixed; boundary=Apple-Mail-1-488093992 X-Trace: sea.gmane.org 1092611968 10764 80.91.224.253 (15 Aug 2004 23:19:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 15 Aug 2004 23:19:28 +0000 (UTC) Cc: Marius Vollmer , guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Aug 16 01:19:21 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BwUHY-0001Fj-00 for ; Mon, 16 Aug 2004 01:19:21 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BwULd-0004af-GI for guile-devel@m.gmane.org; Sun, 15 Aug 2004 19:23:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BwULZ-0004aa-NY for guile-devel@gnu.org; Sun, 15 Aug 2004 19:23:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BwULY-0004aO-5A for guile-devel@gnu.org; Sun, 15 Aug 2004 19:23:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BwULY-0004aL-0T for guile-devel@gnu.org; Sun, 15 Aug 2004 19:23:28 -0400 Original-Received: from [17.250.248.83] (helo=smtpout.mac.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BwUH4-0007vp-Bn for guile-devel@gnu.org; Sun, 15 Aug 2004 19:18:50 -0400 Original-Received: from mac.com (smtpin07-en2 [10.13.10.152]) by smtpout.mac.com (8.12.6/MantshX 2.0) with ESMTP id i7FNInkN022527; Sun, 15 Aug 2004 16:18:49 -0700 (PDT) Original-Received: from [10.0.1.3] (97.157.171.66.subscriber.vzavenue.net [66.171.157.97]) (authenticated bits=0) by mac.com (Xserve/smtpin07/MantshX 4.0) with ESMTP id i7FNImQ5028520 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO); Sun, 15 Aug 2004 16:18:49 -0700 (PDT) In-Reply-To: <4594ABAD-EF11-11D8-BD8D-000A95CD5044@mac.com> Original-To: Richard Todd X-Mailer: Apple Mail (2.619) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3958 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3958 --Apple-Mail-1-488093992 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed this time, with the actual patch...sorry! --Apple-Mail-1-488093992 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="dash_L.patch" Content-Disposition: attachment; filename=dash_L.patch Index: doc/ref/ChangeLog =================================================================== RCS file: /cvsroot/guile/guile/guile-core/doc/ref/ChangeLog,v retrieving revision 1.220 diff -u -r1.220 ChangeLog --- doc/ref/ChangeLog 14 Aug 2004 01:06:13 -0000 1.220 +++ doc/ref/ChangeLog 15 Aug 2004 23:04:27 -0000 @@ -1,3 +1,7 @@ +2004-08-15 Richard Todd + + * scheme-scripts.texi (Invoking Guile): documented new '-L' switch. + 2004-08-14 Kevin Ryde * api-scheduling.texi (Mutexes): New datatype-centric section, adding Index: doc/ref/scheme-scripts.texi =================================================================== RCS file: /cvsroot/guile/guile/guile-core/doc/ref/scheme-scripts.texi,v retrieving revision 1.1 diff -u -r1.1 scheme-scripts.texi --- doc/ref/scheme-scripts.texi 2 Aug 2004 12:29:00 -0000 1.1 +++ doc/ref/scheme-scripts.texi 15 Aug 2004 23:04:28 -0000 @@ -103,6 +103,12 @@ @code{(@var{guile} @var{arg...})}, where @var{guile} is the path of the Guile executable. +@item -L @var{directory} +Add @var{directory} to the front of Guile's module load path. The +given directory is searched before any directories in the GUILE_LOAD_PATH +environment variable. Paths added here are @emph{not} in effect during +execution of the user's @file{.guile} file. + @item -l @var{file} Load Scheme source code from @var{file}, and continue processing the command line. Index: libguile/ChangeLog =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/ChangeLog,v retrieving revision 1.2119 diff -u -r1.2119 ChangeLog --- libguile/ChangeLog 13 Aug 2004 12:28:38 -0000 1.2119 +++ libguile/ChangeLog 15 Aug 2004 23:04:41 -0000 @@ -1,3 +1,8 @@ +2004-08-15 Richard Todd + + * script.c (scm_compile_shell_switches): added '-L' switch to + add to the %load-path. + 2004-08-13 Marius Vollmer * load.c (scm_init_load_path): Do not pass NULL to Index: libguile/script.c =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/script.c,v retrieving revision 1.64 diff -u -r1.64 script.c --- libguile/script.c 12 Aug 2004 17:35:53 -0000 1.64 +++ libguile/script.c 15 Aug 2004 23:04:42 -0000 @@ -361,6 +361,7 @@ "remaining arguments as the value of (command-line).\n" "If FILE begins with `-' the -s switch is mandatory.\n" "\n" + " -L DIRECTORY add DIRECTORY to the front of the module load path\n" " -l FILE load Scheme source code from FILE\n" " -e FUNCTION after reading script, apply FUNCTION to\n" " command line arguments\n" @@ -395,7 +396,9 @@ SCM_SYMBOL (sym_top_repl, "top-repl"); SCM_SYMBOL (sym_quit, "quit"); SCM_SYMBOL (sym_use_srfis, "use-srfis"); - +SCM_SYMBOL (sym_load_path, "%load-path"); +SCM_SYMBOL (sym_set_x, "set!"); +SCM_SYMBOL (sym_cons, "cons"); /* Given an array of command-line switches, return a Scheme expression to carry out the actions specified by the switches. @@ -418,6 +421,7 @@ the "load" command, in case we get the "-ds" switch. */ SCM entry_point = SCM_EOL; /* for -e switch */ + SCM user_load_path = SCM_EOL; /* for -L switch */ int interactive = 1; /* Should we go interactive when done? */ int inhibit_user_init = 0; /* Don't load user init file */ int use_emacs_interface = 0; @@ -496,6 +500,19 @@ scm_shell_usage (1, "missing argument to `-l' switch"); } + else if (! strcmp (argv[i], "-L")) /* add to %load-path */ + { + if (++i < argc) + user_load_path = scm_cons (scm_list_3 (sym_set_x, + sym_load_path, + scm_list_3(sym_cons, + scm_makfrom0str (argv[i]), + sym_load_path)), + user_load_path); + else + scm_shell_usage (1, "missing argument to `-L' switch"); + } + else if (! strcmp (argv[i], "-e")) /* entry point */ { if (++i < argc) @@ -629,6 +646,13 @@ /* After the following line, actions will be added to the front. */ tail = scm_reverse_x (tail, SCM_UNDEFINED); + + /* add the user-specified load path here, so it won't be in effect + during the loading of the user's customization file. */ + if(!SCM_NULLP(user_load_path)) + { + tail = scm_append_x( scm_cons2(user_load_path, tail, SCM_EOL) ); + } /* If we didn't end with a -c or a -s and didn't supply a -q, load the user's customization file. */ --Apple-Mail-1-488093992 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On Aug 15, 2004, at 6:17 PM, Richard Todd wrote: > On Aug 15, 2004, at 4:36 PM, Richard Todd wrote: > >> On Aug 15, 2004, at 4:27 PM, Marius Vollmer wrote: >> >>> Sooo, could you make a new patch that addresses the issues above, if >>> you agree? >> >> Sure. > > Try this patch... I think it addresses everything you mentioned. I > use '-L' now, and the paths end up in %load-path in command-line > left-to-right order. I made an attempt at documenting it in the .texi > files. > > I chose to make the -L flags take effect _after_ loading the user's > .guile file, since I assume it'd be rare that a user actually wants to > redirect their standard startup modules on a per-run basis. If you > disagree with me, just move the place where I do the scm_append_x down > a couple lines. > > Richard > --Apple-Mail-1-488093992 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel --Apple-Mail-1-488093992--