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

Re: PATCH: Add $ZLE_STATE in zle widgets



On Wed, 11 Aug 2010 17:09:48 +0200
Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx> wrote:
> > setopt promptsubst
> > PS1='$MYCONTEXT %# '
> > zle-line-init() {
> >   typeset -g MYCONTEXT=$CONTEXT
> >   zle reset-prompt
> > }
> > zle -N zle-line-init
> >
> > Now "vared -p $PS1" shows up "vared", otherwise I get "start" (or,
> > in principle, "cont").
> 
> But that would put the information in vared's PS1 and not in the one
> of the shell that called vared, wouldn't it? If I could do that, I'd
> know if vared is active even without using its `-p' option.
> 
> I could live with doing this, though:
>     vared() { builtin vared -p 'vared %% ' "$@" }

vared doesn't have a prompt by default, so unless you're passing it one (in
which case you can always do somethign like what you're suggesting) I don't
see how there can be a problem.  Do you really mean you want a default
prompt for vared?  A wrapper for vared would probably be the best way of
doing that.

You're not talking about some use of recursive editing to read information
while the line editor is active, are you?  You can't do that with vared,
since zle isn't recursive, but you can do it with recursive-edit.  For the
same reason there's no question of having a valid shell prompt outside
vared while vared is running --- vared with its prompt (or lack of one) is
the only instance of zle at that point, and when zle is next started you
get a fresh prompt.

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



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