Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ${(k)widgets} v. 'zle -la'



On Jul 5,  4:57am, Daniel Shahaf wrote:
} Subject: ${(k)widgets} v. 'zle -la'
}
} $ zsh -f
} % bindkey zzzzzz foobar
} % zle -la | grep foobar                   
} % print -rl -- ${(k)widgets} | grep foobar 
} foobar
} % 
} 
} Is it intentional that 'foobar' is listed by 'zle -la' but not by
} ${(k)widgets}?  I'd expected those two to enumerate the same set of
} widgets.

It's actually the other way around, yes?  It's in $widgets but not in
"zle -la"?  

} Observations:
} 
} - The manual speaks of "all existing widgets" for the former and of "all
}   defined widgets" for the latter.

("the former" == zle, "the latter" == $widgets) That's not quite what the
doc for $widgets says, but in any case you're missing the crucial bit:
"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.

Now you might argue that any widget that isn't a builtin must be user-
defined, so naming a widget that doesn't exist should cause that widget
to be listed by "zle -la".  However, you'd be forgetting that zmodload
may pull in additional builtin widgets, so there's no reason for zle to
presume that "foobar" will eventually become user-defined as opposed to
becoming a module-defined builtin.



Messages sorted by: Reverse Date, Date, Thread, Author