zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH: Add $ZLE_STATE in zle widgets
Date: Wed, 11 Aug 2010 15:45:14 +0100	[thread overview]
Message-ID: <20100811154514.58e9c4a8@csr.com> (raw)
In-Reply-To: <87hbj171ik.fsf@ft.bewatermyfriend.org>

On Wed, 11 Aug 2010 14:54:42 +0200
Frank Terbeck <ft@bewatermyfriend.org> wrote:
> Peter Stephenson wrote:
> > Peter Stephenson <Peter.Stephenson@csr.com> wrote:
> >> > I'm pretty happy with my current setup anyway. It would be cool
> >> > to have a way to add a "V" mode to my prompt when `vared' is
> >> > active. That could probably be done with {pre,post}-vared hook
> >> > widgets. I didn't look into that yet, though.  (Actually, since
> >> > I wrote this mail while being on a train, I did look at this by
> >> > now. This is not as trivial as I had hoped, since zle cannot be
> >> > run recursively. Oh well, I'm rarely using `vared' anyway.)
> >> 
> >> Should be trivial to add this to ZLE_STATE internally.
> >
> > Turns out you can already test [[ $CONTEXT = vared ]].
> 
> Yes. But for my problem (signal that a vared is running in the shells
> *main* prompt) that doesn't help, because there's no widget called
> at the right time.

The following seemed to work, am I missing what you're doing?

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

-- 
Peter Stephenson <pws@csr.com>            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


  reply	other threads:[~2010-08-11 14:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03  0:57 PATCH: Add $OVERSTRIKE " Frank Terbeck
2010-08-03  8:52 ` Peter Stephenson
2010-08-03  9:44   ` Frank Terbeck
2010-08-03  9:58     ` Peter Stephenson
2010-08-03 20:43       ` PATCH: Add $ZLE_STATE " Frank Terbeck
2010-08-06 20:23         ` Frank Terbeck
2010-08-11 12:02           ` Peter Stephenson
2010-08-11 12:44             ` Peter Stephenson
2010-08-11 12:54               ` Frank Terbeck
2010-08-11 14:45                 ` Peter Stephenson [this message]
2010-08-11 15:09                   ` Frank Terbeck
2010-08-11 16:30                     ` Peter Stephenson
2010-08-11 13:19             ` Frank Terbeck

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=20100811154514.58e9c4a8@csr.com \
    --to=peter.stephenson@csr.com \
    --cc=zsh-workers@zsh.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.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).