Zsh Mailing List Archive
Messages sorted by:
Re: precmd, preexec, and supplied prompt themes
- X-seq: zsh-workers 23948
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: precmd, preexec, and supplied prompt themes
- Date: Sat, 13 Oct 2007 10:11:18 -0700
- In-reply-to: <20071013133057.GA1500@xxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <DD973F2C-E6A0-4FCA-96F5-6C96701DC677@xxxxxxxxxxxxxxxxxx> <20071012215906.GA8935@mastermind> <20071012152257.91edf6d3.wgscott@xxxxxxxxxxxxxxxxxx> <20071013133057.GA1500@xxxxxxxxxxx>
On Oct 13, 9:30am, Clint Adams wrote:
} > typeset -a precmd_functions
} > precmd_functions += my_prompt_precmd
} Since there is no unregistration hook, how would you avoid the problem
} of precmd_functions containing (my_prompt_precmd her_prompt_precmd
} his_prompt_precmd my_prompt_precmd) when switching back and forth?
Well, there sort of is an unregistration hook: prompt_off_setup
(meant to be invoked as "prompt off").
However, all it does is erase the precmd and preexec functions entirely,
which is why I added an "off" switch to my theme ("prompt bart off").
*IF* we updated the themes to be clever about precmd_functions et al.,
then the "prompt" function should be updated to call prompt_off_setup
before installing a new theme.
However, that leaves the conundrum of whether/how to unregister PS1.
"prompt bart", for example, piggybacks itself on top of whatever is
already in PS1, and "prompt bart off" extricates itself to leave PS1
mostly as it was before.
Right now "prompt off" stomps PS1 and PS2 back to the "zsh -f" default.
So some discussion of how this ought to be redesigned would be useful
before someone jumps in to do it. It's always seemed a bit clunky to
me to do build up function names by sticking the theme name in the
middle, but that's at nit-pick. Maybe all we need is another one of
those functions, prompt_ZZZ_off (or pick another word).
Messages sorted by: