unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Richard Todd <rwtodd@mac.com>
Cc: Marius Vollmer <mvo@zagadka.de>, guile-devel@gnu.org
Subject: Re: -I for guile command line
Date: Sun, 15 Aug 2004 18:18:46 -0500	[thread overview]
Message-ID: <7587CDB5-EF11-11D8-BD8D-000A95CD5044@mac.com> (raw)
In-Reply-To: <4594ABAD-EF11-11D8-BD8D-000A95CD5044@mac.com>

[-- Attachment #1: Type: text/plain, Size: 43 bytes --]

this time, with the actual patch...sorry!


[-- Attachment #2: dash_L.patch --]
[-- Type: application/octet-stream, Size: 4790 bytes --]

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  <rwtodd@mac.com>
+
+	* scheme-scripts.texi (Invoking Guile): documented new '-L' switch.
+
 2004-08-14  Kevin Ryde  <user42@zip.com.au>
 
 	* 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  <rwtodd@mac.com>
+
+	* script.c (scm_compile_shell_switches): added '-L' switch to
+	add to the %load-path.
+
 2004-08-13  Marius Vollmer  <marius.vollmer@uni-dortmund.de>
 
 	* 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.  */

[-- Attachment #3: Type: text/plain, Size: 812 bytes --]




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
>

[-- Attachment #4: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

  reply	other threads:[~2004-08-15 23:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-02  1:35 -I for guile command line Richard Todd
2004-07-10  0:12 ` Kevin Ryde
2004-07-10  1:28   ` Richard Todd
2004-08-15 21:27 ` Marius Vollmer
2004-08-15 21:36   ` Richard Todd
2004-08-15 23:17     ` Richard Todd
2004-08-15 23:18       ` Richard Todd [this message]
2004-08-21 17:45       ` Marius Vollmer
  -- strict thread matches above, loose matches on Subject: below --
2004-07-05 17:56 Andy Wingo

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/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7587CDB5-EF11-11D8-BD8D-000A95CD5044@mac.com \
    --to=rwtodd@mac.com \
    --cc=guile-devel@gnu.org \
    --cc=mvo@zagadka.de \
    /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.
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).