set-environment-variable Lassi Kortela (05 Dec 2019 00:18 UTC)
Re: set-environment-variable John Cowan (05 Dec 2019 19:48 UTC)
Re: set-environment-variable hga@xxxxxx (06 Dec 2019 00:29 UTC)
Re: set-environment-variable Lassi Kortela (06 Dec 2019 09:55 UTC)
Re: set-environment-variable John Cowan (06 Dec 2019 13:21 UTC)
Re: set-environment-variable Lassi Kortela (06 Dec 2019 13:53 UTC)
Re: set-environment-variable John Cowan (06 Dec 2019 17:51 UTC)
Re: set-environment-variable Arthur A. Gleckler (06 Dec 2019 18:45 UTC)
Re: set-environment-variable Lassi Kortela (06 Dec 2019 19:00 UTC)
Re: set-environment-variable Lassi Kortela (06 Dec 2019 20:41 UTC)
Re: set-environment-variable hga@xxxxxx (07 Dec 2019 15:07 UTC)
Re: set-environment-variable Lassi Kortela (07 Dec 2019 16:14 UTC)
Re: set-environment-variable Lassi Kortela (07 Dec 2019 16:23 UTC)
Re: set-environment-variable hga@xxxxxx (07 Dec 2019 16:30 UTC)
Re: set-environment-variable John Cowan (07 Dec 2019 17:31 UTC)
Re: set-environment-variable Lassi Kortela (07 Dec 2019 20:12 UTC)
Is set-environment-variable needed after all? Lassi Kortela (07 Dec 2019 20:15 UTC)
Re: Is set-environment-variable needed after all? John Cowan (07 Dec 2019 21:13 UTC)
Re: Is set-environment-variable needed after all? Lassi Kortela (08 Dec 2019 19:36 UTC)
Re: Is set-environment-variable needed after all? hga@xxxxxx (08 Dec 2019 20:08 UTC)
Re: Is set-environment-variable needed after all? Lassi Kortela (09 Dec 2019 11:00 UTC)
Re: Is set-environment-variable needed after all? Duy Nguyen (09 Dec 2019 03:51 UTC)
Re: Is set-environment-variable needed after all? John Cowan (09 Dec 2019 04:21 UTC)
Re: Is set-environment-variable needed after all? Lassi Kortela (09 Dec 2019 10:39 UTC)
Re: Is set-environment-variable needed after all? Lassi Kortela (09 Dec 2019 10:41 UTC)
Re: Is set-environment-variable needed after all? Duy Nguyen (09 Dec 2019 10:45 UTC)
Re: Is set-environment-variable needed after all? Lassi Kortela (09 Dec 2019 10:49 UTC)
Re: Is set-environment-variable needed after all? John Cowan (09 Dec 2019 19:36 UTC)
Re: Is set-environment-variable needed after all? Lassi Kortela (09 Dec 2019 19:46 UTC)

Re: Is set-environment-variable needed after all? Lassi Kortela 09 Dec 2019 19:45 UTC

> Capture the value of $EDITOR (actually you are supposed to look at
> $VISUAL first, and if it is undefined then look at $EDITOR) in a
> variable of  the (ed) library.  Then just use that variable henceforth.
> You can expose a set-editor! procedure to change it.

Then (get-environment-variable "EDITOR") and (get-editor) would
needlessly produce different results if the editor has been changed. And
any subprocess would get the old EDITOR again unless you use a
:environment alist as a third mechanism for changing the same thing.

> The above ideas avoid this.  If your program doesn't change any
> environment variables, use get-environment-variable freely.  If it does,
> capture the whole environment early in a global variable as an alist,
> search it with assoc, push things on the alist as you will, and pass it
> to all calls to spawn-process.

There are pros and cons to that approach.

> (I have updated ProcessesCowan to make it
> clear that if the same key appears more than once, the first value is
> put into the environment by spawn-process.)

This is good to specify.

> Not just that, but because putenv() can be used for dynamic binding
> without leaks, as I explained.

I wonder how many people understand that. That API is not for the faint
of heart.

>     We could also write a separate SRFI as a follow-up to SFI 98 with just
>     set-environment-variable! and delete-environment-variable! :) As was
>     done with the timespec SRFI.
>
> They are Posix but not C, so if they belong anywhere at all (and I think
> they don't), it's in the Posix SRFI.

WinAPI also has procedures to get and set them, as do most other OSes
probably.