Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ${(k)widgets} v. 'zle -la'
- X-seq: zsh-users 21738
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: ${(k)widgets} v. 'zle -la'
- Date: Thu, 07 Jul 2016 02:00:23 +0000
- In-reply-to: <160705140120.ZM17175__36700.8317648017$1467752558$gmane$org@torch.brasslantern.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: <20160705045758.GA18441@tarsus.local2> <160705140120.ZM17175__36700.8317648017$1467752558$gmane$org@torch.brasslantern.com>
Bart Schaefer wrote on Tue, Jul 05, 2016 at 14:01:20 -0700:
> On Jul 5, 4:57am, Daniel Shahaf wrote:
> } $ zsh -f
> } % bindkey zzzzzz foobar
> } % zle -la | grep foobar
> } % print -rl -- ${(k)widgets} | grep foobar
> } foobar
> } %
>
> "zle -la" lists only USER-DEFINED widgets, wheras $widgets includes ALL
> widgets. In your example the "foobar" widget doesn't exist yet, so it
> isn't user-defined, so "zle -la" doesn't show it.
Thanks for the explanation.
Is the following behaviour also intentional? Testing a key's presence
in the associative array in different ways gives different results:
% bindkey foo bar
% () { print $(( $argv[(I)bar] > 0 )) } ${(k)widgets}
1
% print ${+widgets[bar]}
0
I ran into this while trying to clarify the docs of $widgets in line
with your answer.
Thanks again,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author