guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Would a patch to execute "startup configuration code" be welcome?


From: Rob Browning
Subject: Re: Would a patch to execute "startup configuration code" be welcome?
Date: 14 Jan 2001 15:17:10 -0600
User-agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.7

thi <address@hidden> writes:

> for this example, the same effect can be achieved with:
> 
> #!/bin/sh
> export LD_LIBRARY_PATH=/dir/with/sub-lib/needed/by/libcustomization.so
> exec guile -s $0 "$@"
> !#
> (set! %load-path (cons "somedir" %load-path))
> (use-modules (some special customization))
> (initialize-something-important)
> ;;; eof
> 
> with less quoting hair.  does this work for you?

If you change the -s to a -l, then yes, that might be perfect.  It
looks like you can call this script with command line args that behave
normally behave normally.  Thanks much -- that's quite helpful.

The other problem I ran in to might be harder to do anything about
(without Godot).  The problem is that if want to invoke this script
and get a prompt, all you have to do is avoid any extra -s or -c args
(just as with a normal guile invocation), but when you finally reach
the prompt, none of the effects of use-modules will be visible because
they're executed in the (guile) module context, not the (guile-user)
module context.

If there's no better way to fix this, is there a way to check to see
if you're going to end up in an interactive context?  So I could add
something like:

  ...
 (set! %load-path (cons "somedir" %load-path))
 (if headed-for-guile-user? (define-module (guile-user)))
 (use-modules (some special customization))
 ...

of course this might be "bad"(TM) depending on when the -l args are
invoked because things that happen after this script might expect to
be in the (guile) module context.

Anyway, thanks very much for the help.

-- 
Rob Browning <address@hidden> PGP=E80E0D04F521A094 532B97F5D64E3930



reply via email to

[Prev in Thread] Current Thread [Next in Thread]