Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 4.3.17 unset RPS1 vs RPROMPT



On 29/06/2012, Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:
> zsh 4.3.17, multiple OSes.
>
> Using "prompt walters", I get a green right-prompt.
> Using "prompt pdp" to invoke my own setup, I still have it.
> I debug.  I have "unset RPS1" in my setup function.
> Strange, try at command-line.
>
>  unset RPS1       # no effect
>  unset RPROMPT    # works
>
> I see Src/params.c:
> IPDEF7("RPS1", &rprompt),
> IPDEF7("RPROMPT", &rprompt),
>
> and I know that the docs claim them equivalent.
>
> So try with "zsh -f", and it works.  Some debugging later, and I find
> that if I "unset RPS1" then "typeset -p RPS1 RPROMPT" shows just
> RPROMPT, not both.  If I then call "prompt walters", then RPROMPT will
> be set and can only be cleared with "unset RPROMPT".
>
> If I also "unset RPROMPT", then it comes back into being as a magic
> variable during prompt setup.  If I assign to RPS1, then it too comes
> back as a magic variable bound to the same internal rprompt.
>
> Is it expected that RPROMPT and RPS1 can be decoupled in this way?
> Is there a correct way to clear the prompt, other than *always* having
> to do "unset RPROMPT RPS1" because one or the other may have become
> decoupled?
>
> I don't see it documented and it seems very strange to me.  I'd expect
> that if one is unset, the rprompt content gets unset, but assigning to
> either would instantiate the other again, since it can't be reused by a
> user anyway -- if they unset and then assign to a new value, it still
> changes the same C level "rprompt" variable.
>
> Thoughts?

Does it help if you remove the 'export's in prompt_walters_setup?

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author