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

Re: Does add-zle-hook-widget violate the contract of ZLE hook widgets?



On Wed, Jun 23, 2021, at 5:57 PM, Daniel Shahaf wrote:
> Marlon Richert wrote on Wed, 23 Jun 2021 20:30 +00:00:
> > foo implements a perfectly fine zle-line-init widget. It obeys the
> > contract laid out at
> > https://zsh.sourceforge.io/Doc/Release/Zsh-Line-Editor.html#Special-Widgets,
> > which says nothing about return values.
> 
> That has two possible interpretations:
> 
> - Hook functions may set $? however they want
> 
> - Hook functions should set $? to zero on success and to non-zero
>   otherwise
> 
> In favour of the first interpretation is that the manual's language
> doesn't explicitly rule it out

It's worth noting that the "Hook Functions" section, while not
saying anything about ZLE hook functions in particular, does say:

	A function found by this mechanism is referred to elsewhere
	as a 'hook function'.  An error in any function causes
	subsequent functions not to be run.

https://zsh.sourceforge.io/Doc/Release/Functions.html#Hook-Functions

-- 
vq




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