zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: Some questions regarding prompt themes
Date: Mon, 16 Aug 2004 01:37:38 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.61.0408160052080.21654@toltec.zanshin.com> (raw)
In-Reply-To: <2004-08-16T08-32-23@devnull.michael-prokop.at>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3237 bytes --]

On Mon, 16 Aug 2004, Michael Prokop wrote:

>   Is using 'export PROMPT' in prompt-themes reasonable?

Evidently Colin Walters thought so, or whoever stole from him.  It's not 
ideal.  The prompinit wrapper saves and restores PS1 et al., but not 
PROMPT nor RPROMPT, when running preview.  I would have expected the 
restoration of PS1 at exit from the function to restore PROMPT as a 
side-effect of their linkage, and it seems to do so when I try it, so I 
don't know offhand what's happening to you.

The "mike@tweety ~ % " prompt doesn't look like it came from any of the
zsh prompt themes I'm familiar with.  Certainly not walters, which would 
be "mike@tweety> ", nor zefram which is always the last theme previewed.

> * Is it possible to "break out" of a precmd­statement?

I don't know what you're asking.

>   Some themes are using the precmd-option

Yes, sadly, several of the themes assume you don't have anything better to 
do with your precmd than fiddle with the prompt.  You'll note the "bart"
theme goes to some lengths to avoid wrecking any existing precmd function.

>   e.g. prompt_adam1_setup sets the prompt via the precmd statement.
>   AFAICS this results in problems when running stuff like
>     export PS1='test'
>   manually ­ which IMHO does not work as it should.

Hey, you either get a themed prompt or you don't.  Why would you expect 
that assigning to PS1 was enough to disable an entire prompt theme?

(Just wait until we get ksh-style "discipline functions," though.)

> * Would it be possible that 'prompt -p' does *not* export any
>   prompt-variables so the prompt doesn't get modified by just
>   running a preview of one/some/all themes?

"prompt -p" doesn't do anything except make a stab at saving state and 
then blindly run each of the theme setup and preview functions in turn.  
It's up to the theme writers to make the themes play nice, and some of 
them don't, er, didn't.

Probably preview (and help) could be executed in a subshell nowadays, to 
avoid all this hassle.  When the theme system was first written, some 
things like the job table didn't behave well in subshells, but that's 
pretty much been fixed up in 4.2.x.

> * Does there exist a way to reset all prompt-values? Something like
>   'prompt reset' would be very nice IMHO.

Nothing's changed since I wrote the previous response that you excerpted:
| To really have "prompt off" mean what it seems to mean, the theme system
| would have to save and restore the original values of all the variables.

The theme system does not save the original values of all the variables.

> * What's the "right" way to set variables in a prompt-theme to avoid
>   problems with other themes?  Would it make sense to "unset PS1
>   PS2..." at the beginning of a prompt-theme to avoid any
>   side-effects from other themes?

It's a philosophical thing.  E.g. "prompt bart" doesn't mess with RPS1 
except to color it; so whatever the previous value was will still be 
there, which is fine because my prompt doesn't need it for anything.  My 
theme also keeps whatever was in PS1 to begin with, it just prefixes it 
with more stuff.

But none of the prompt themes know about RPS2, because it didn't exist
when the theme system was written.

  reply	other threads:[~2004-08-16  8:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-16  7:20 Michael Prokop
2004-08-16  8:37 ` Bart Schaefer [this message]
2004-08-16 11:00   ` Michael Prokop

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

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

  git send-email \
    --in-reply-to=Pine.LNX.4.61.0408160052080.21654@toltec.zanshin.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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.vuxu.org/mirror/zsh/

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 NNTP newsgroup(s).