From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23542 invoked by alias); 11 Aug 2010 15:10:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28144 Received: (qmail 29231 invoked from network); 11 Aug 2010 15:10:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at bewatermyfriend.org does not designate permitted sender hosts) From: Frank Terbeck To: Peter Stephenson Cc: zsh-workers@zsh.org Subject: Re: PATCH: Add $ZLE_STATE in zle widgets In-Reply-To: <20100811154514.58e9c4a8@csr.com> (Peter Stephenson's message of "Wed, 11 Aug 2010 15:45:14 +0100") References: <20100803105823.1232a42b@csr.com> <1280868200-11220-1-git-send-email-ft@bewatermyfriend.org> <87vd7n8p7u.fsf@ft.bewatermyfriend.org> <20100811130250.31da4e84@csr.com> <20100811134420.14c58317@csr.com> <87hbj171ik.fsf@ft.bewatermyfriend.org> <20100811154514.58e9c4a8@csr.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Date: Wed, 11 Aug 2010 17:09:48 +0200 Message-ID: <877hjx6v9f.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Df-Sender: 430444 Peter Stephenson wrote: > On Wed, 11 Aug 2010 14:54:42 +0200 > Frank Terbeck wrote: >> Peter Stephenson wrote: >> > Peter Stephenson 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"). 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 %% ' "$@" } Regards, Frank