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

Re: Why does _main_complete not try the next completer when $_comp_mesg is non-zero?



Marlon Richert wrote on Thu, Apr 01, 2021 at 08:11:35 +0300:
> 
> > On 1. Apr 2021, at 2.20, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> >> 
> >>   autoload +X -Uz _complete
> >>   functions[_autocomplete._complete]=$functions[_complete]
> >>   _complete() {
> >>     _autocomplete._complete "$@"
> >>     local -i ret=$?
> >>     (( ret )) && _comp_mesg=''
> >>     return ret
> > 
> > Considered using an «{ } always { }» block?
> 
> What for?

For clarity, since it seems that's the pattern you're shooting for.
Also, it would take care of preserving $?.

> I have no need to ever restore the original _complete().

An always block wouldn't do this.

Cheers,

Daniel




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