Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Redefining an array of widgets
- X-seq: zsh-users 16094
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Guido van Steen <gvsteen@xxxxxxxxx>
- Subject: Re: Redefining an array of widgets
- Date: Mon, 13 Jun 2011 00:02:32 +0200
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=ExvXDKZtolEgZFHFXbVhX5FOYzFrOtQzuwf0Srt8WGk=; b=ocobI+ChBze0ABB6j2st3fjHIk2wZUmtFvzy234E88YP5KS/ihey5IygXwHMpq1H20 6cyTAZdmUBEsVGtM8rz/07o/mBO1o8qf27ncBAjiWucQW8efMzjWgKsCCCSFjQEHbQKj ZLXlWRqOagS0KchYZ34sM5x8h5JceSrU8wYMg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=gPzHfP0MlYvccvK9qSOKZ5LqNgT/2Wj3BfVDl9DN887Ca60gCXXDE83S3u2ggTuF0T gLgOxH2GTiew1gOXA+98+1bAwYxWx4sQgZ6QCNQdCYUVfhtednX+Nsqbgk8eBoh8WsSe cxs2/XXqcRhmCQojcLRHqRaqpv+eAiXT3zxWY=
- In-reply-to: <744100.71536.qm@web65610.mail.ac4.yahoo.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <744100.71536.qm@web65610.mail.ac4.yahoo.com>
On 12 June 2011 23:34, Guido van Steen <gvsteen@xxxxxxxxx> wrote:
> Dear List
>
> I would like to "overload/redefine" some widgets. What I have in mind is this:
>
> Each time the widgets are called, some additional task should be performed first. After that the actual widget should be called.
>
> It seems easy to do this for one or two widgets, e.g. "delete-char", and "backward-delete-char":
>
> user% function delete-char() {
> function> zle do_some_stuff
> function> zle .delete-char
> function> }
> user% zle -N delete-char
> user% function backward-delete-char() {
> function> zle do_some_stuff
> function> zle .backward-delete-char
> function> }
> user% zle -N backward-delete-char
>
> However, things would be a lot more flexible if I could define a list of widgets, such as:
The easiest way to do this is something like this
function do-some-stuff-and-widget() {
zle do_some_stuff
zle .$WIDGET
}
zle -N backward-delete-char do-some-stuff-and-widget
zle -N ...
for every widget you want to override. You can use a for loop to call
zle multiple times.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author