Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Calling a zle widget from a function
- X-seq: zsh-users 11552
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Calling a zle widget from a function
- Date: Tue, 12 Jun 2007 17:53:54 +0100
- In-reply-to: <20070612162322.GF12698@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20070612144404.GN14435@xxxxxxxxxxxxxxxxxxxx> <200706121514.l5CFEaH5029180@xxxxxxxxxxxxxx> <20070612162322.GF12698@xxxxxxxxxxxxxxx>
Frank Terbeck wrote:
> So, that means that (no matter if using v4.2 or v4.3) you cannot call
> widgets from the commandline, right?
From the *command line* you can: type Esc x and enter the name of the
widget (or bind it with bindkey). From something executed as an
ordinary piece of shell code from the command line, and in particular
from a trap, you can't.
> And how would you 'hook' into zle? I don't know what you meant by
> that.
You can redefine any standard widget to get it to execute your own code
as well as its normal function. This is sometimes done with
accept-line:
accept-line() {
my-code
zle .accept-line
}
zle -N accept-line
However, I don't think there's anything you can intercept when zle is
idle. You can "kick" zle with "zle -I" from outside it to cause it to
redisplay, but as far as I can see that doesn't go through any
user-redefinable widgets. So that doesn't seem to help either.
There are a limited number of "real" hooks (zle-line-init and
zle-keymap-select), although I called them "special widgets" which
wasn't a particular clever name, but neither of them helps here either.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview
Messages sorted by:
Reverse Date,
Date,
Thread,
Author