Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Redefining an array of widgets
- X-seq: zsh-users 16093
- From: Guido van Steen <gvsteen@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Redefining an array of widgets
- Date: Sun, 12 Jun 2011 14:34:25 -0700 (PDT)
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1307914465; bh=J+X1YfQSbocWRPQAdReLxS8szKWtJ4M9e9epEm9tfsc=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=cT7UqD3UWNde38FMP0szEt5VS0fYS3XY3WvXrNg8xxc4nHV9Pzz29JlaEr7jy1QAvDC41DfzhiRUX4HEl2yl7TxLr0Vj40beIrPtNllwj8fmP6+4GW2nUoHjl2EyvM+SiJlVlKHyWbMQq7Ktm2JCp2nGt6EapDGzvg1QlJxe6j8=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=JZrDe7Cvx9d5HDGYjUg3jur0t65eZuAfPDRiELlPxUhuwPCJwqpitRRCYrN1nvCs5Fm+D7HtDlwwxkAMWkWeO0Q4DLDUKHsDCyfmMqK/e3sUR/ohWDSkvo8kAU3QZrEgZiAjDFTcXZG0LmH4bxXPE1bxVauaLztE7Vog5wuOFEE=;
- 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
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:
user% widgets_to_be_overloaded=(delete-char backward-delete-char)
and then perform some pseudo code like:
user% for i in {1..$#widgets_to_be_overloaded}; do
for> function $widgets_to_be_overloaded[i]() {
for function> region_highlight=()
for function> zle .$widgets_to_be_overloaded[i]
for function> }
for> zle -N $widgets_to_be_overloaded[i]
for> done
As I actually had expected, this pseudo code does not work. It reports, instead:
zsh: no matches found: widgets_to_be_overloaded[i]
Could someone explain to me what I should change to make it yield the intended results.
Thanks in advance!
Guido van Steen
Messages sorted by:
Reverse Date,
Date,
Thread,
Author