Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] add-zle-hook-widget
- X-seq: zsh-workers 38741
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] add-zle-hook-widget
- Date: Tue, 21 Jun 2016 15:58:11 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=UufBRhHPmDTy8UHRDUdmg5oyc93zh6Fb0z3qHUF4ISQ=; b=V4jb2GvhYNdn64R1NHQfW8ci7u6oY9RG+7hygw5YUgd4JG8vB8/ED3CmrYB+W61u79 EOlUb1eBGbMq1yElsS6rZqsZfG20vO3ODwJEXFh1MpWOBUWkKBO38lpiGwA3kB64yLBr 2MNUefTrhJ+LDpfBEHQPHZeV1Vo3tTl4G3B41RjlRezdSk4asHZulpF0y9/nsESD9631 zpijrtxzep9eG2+rJ+Ly/lFJlERpKml/sgwNhmI0GOkvErAhixrwl8CesxusHZRdyoGS 9nBQz6zZfM60rnLT+phtvm44bA/SLNTOTcNWUbBYJ1r4p4cUCyxiLmhMQbYLMxeasUD0 yvOg==
- In-reply-to: <20160621014131.GB17100@tarsus.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <160612184453.ZM11316@torch.brasslantern.com> <20160613085219.GA23148@tarsus.local2> <160614111054.ZM17893@torch.brasslantern.com> <20160615232447.GA29225@tarsus.local2> <160616222055.ZM27034@torch.brasslantern.com> <160618162558.ZM5244@torch.brasslantern.com> <20160621014131.GB17100@tarsus.local2>
On Jun 21, 1:41am, Daniel Shahaf wrote:
} Subject: Re: [PATCH] add-zle-hook-widget
}
} Bart Schaefer wrote on Sat, Jun 18, 2016 at 16:25:58 -0700:
} > for hook in $hooktypes
} > do
} > + # Check for an existing widget, add it as the first hook
} > + if [[ ${widgets[$hook]} = user:* ]]; then
} > + zle -A "$hook" "${widgets[$hook]}"
} > + zstyle -- "$hook" widgets 0:"${widgets[$hook]}"
}
} The last parameter expansion should strip the "user:" prefix.
No, it shouldn't, because the "zle -A" command creates a new widget
whose name begins with "user:".
This way if you run "add-zle-hook-widget -L" it will show you that the
widget with index zero was the user's previously defined widget.
Yes, this breaks things if the user's widget compares itself to $WIDGET
but there's no way around that [*] because the newly created hook is
the only widget allowed to use the reserved hook-widget name.
[*] A possible fix for this is to omit the -w when calling the widget
from zle, so that $WIDGET remains the hook-widget. That would look
something like
for hook in "${(@)${(@on)hook_widgets[@]}#<->:}"; do
if [[ "$hook" = user:* ]]; then
# Do not change $WIDGET, it may be tested in $hook
zle "$hook" -N "$@" || return
else
zle "$hook" -Nw "$@" || return
fi
done
Messages sorted by:
Reverse Date,
Date,
Thread,
Author