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

Re: dynamic named directories clobber $reply



On 4 June 2011 23:24, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Sat, 4 Jun 2011 14:24:14 +0200
> Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>> I noticed that after a successful ~[something] substitution, ~[] or
>> ~[invalid] would return the same substitution, because $reply leaks to
>> the parent shell, and my function doesn't unset $reply when it doesn't
>> find anything valid.
>
> In addition to Bart's reply, this would only be an actual bug if it was
> happening when your function returned non-zero, which is what it's supposed to
> do if it doesn't have a match.

Yeah, it turned out I forgot to return 1 on failure in my function. I
was worried about the hooks not having any way to unset reply so they
wouldn't clobber eachothers' results, but then I realized I was
confusing it with the completion case where they all get to add stuff.
In the n case though, as soon as one hook returns true no more hooks
are called so it should be fine.

-- 
Mikael Magnusson



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