From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8224 invoked by alias); 4 Jun 2011 18:46:11 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29458 Received: (qmail 26454 invoked from network); 4 Jun 2011 18:46:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110604114545.ZM19743@torch.brasslantern.com> Date: Sat, 04 Jun 2011 11:45:45 -0700 In-reply-to: Comments: In reply to Mikael Magnusson "dynamic named directories clobber $reply" (Jun 4, 2:24pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh workers Subject: Re: dynamic named directories clobber $reply MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jun 4, 2:24pm, Mikael Magnusson wrote: } Subject: dynamic named directories clobber $reply } } 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. If I make it local in the function it doesn't } work at all, is there some way it can be local in the hook somehow? I'd say the short answer to that is "no". Nothing else that uses reply/REPLY internally to the shell invokes any kind of local context for them. However, the hook conceivably could explicitly unset reply before the call to the shell function. This would have to happen in Src/utils.c subst_string_by_hook(), and presumably only if a function or variable named zsh_directory_name was actually found. I'm undecided whether that's the correct thing to do, or whether it really should be up to the shell function to make sure reply is correct regardless of whether it found a match or not. It's unclear because in the case of an array of zsh_directory_name_hook functions, you may not want each to go clobbering the results of the one before.