unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Thompson, David" <dthompson2@worcester.edu>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: guix environment & PS1
Date: Wed, 1 Jul 2015 09:59:06 -0400	[thread overview]
Message-ID: <CAJ=RwfYJkDSgtk2V--O0eH-eZSH1X+9U496H1YQMSOQS0Kp+kg@mail.gmail.com> (raw)
In-Reply-To: <87y4j0t45k.fsf@gnu.org>

On Wed, Jul 1, 2015 at 9:10 AM, Ludovic Courtès <ludo@gnu.org> wrote:
> "Thompson, David" <dthompson2@worcester.edu> skribis:
>
>> On Thu, Jun 25, 2015 at 7:45 AM, Ludovic Courtès <ludo@gnu.org> wrote:
>>> Cyril Roelandt <tipecaml@gmail.com> skribis:
>>>
>>>> +(define (run-shell shell env-name)
>>>> +  "Run the given SHELL, adding '(ENV-NAME) ' at the start of the prompt."
>>>> +  (cond ((string=? shell "/bin/bash")
>>>> +         (let* ((directory (or (getenv "TMPDIR") "/tmp"))
>>>> +                (template  (string-append directory "/guix-file.XXXXXX"))
>>>> +                (out       (mkstemp! template)))
>>>> +           (format out "export PS1=\"(~a) $PS1\"" env-name)
>>>> +           (flush-output-port out)
>>>> +           (system (string-append "/bin/bash --rcfile " template))))
>>>
>>> What about this simpler idea: ‘guix environment’ would unconditionally
>>> do:
>>>
>>>   (setenv "GUIX_ENVIRONMENT" "t")
>>>
>>> and then users can choose in their .bashrc to use a separate PS1 when
>>> GUIX_ENVIRONMENT is defined.
>>>
>>> WDYT?
>>
>> +1
>>
>> This is much better.
>
> I’ve pushed something like that in ‘wip-environment’; comments welcome.
>
> I reckon it has the unfortunate property of not working out of the box
> (except on GuixSD.)  I’m sure many tools these days would choose to
> hard-code a fancy colored PS1; while I prefer things that work out of
> the box, I’m not comfortable with hard-coding such things.
>
> Thoughts?

I agree with you.  I'd rather not hard-code some fancy PS1.

- Dave

  reply	other threads:[~2015-07-01 13:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 21:41 [PATCH] guix environment: add a '--env-name' option Cyril Roelandt
2015-06-25 11:45 ` guix environment & PS1 Ludovic Courtès
2015-06-25 12:02   ` Ricardo Wurmus
2015-06-25 13:04     ` Thompson, David
2015-06-25 13:28       ` Ricardo Wurmus
2015-06-25 20:00         ` Claes Wallin (韋嘉誠)
2015-06-25 20:40           ` Claes Wallin (韋嘉誠)
2015-06-29  8:41           ` Ludovic Courtès
2015-06-29 10:04             ` Claes Wallin (韋嘉誠)
2015-06-25 13:02   ` Thompson, David
2015-07-01 13:10     ` Ludovic Courtès
2015-07-01 13:59       ` Thompson, David [this message]
2015-07-01 17:07         ` Claes Wallin (韋嘉誠)

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://guix.gnu.org/

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

  git send-email \
    --in-reply-to='CAJ=RwfYJkDSgtk2V--O0eH-eZSH1X+9U496H1YQMSOQS0Kp+kg@mail.gmail.com' \
    --to=dthompson2@worcester.edu \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).