zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: dynamic named directories clobber $reply
Date: Sat, 04 Jun 2011 11:45:45 -0700	[thread overview]
Message-ID: <110604114545.ZM19743@torch.brasslantern.com> (raw)
In-Reply-To: <BANLkTimQNrEJgK+4h2Pba-diNLL-hE+JjA@mail.gmail.com>

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.


  reply	other threads:[~2011-06-04 18:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-04 12:24 Mikael Magnusson
2011-06-04 18:45 ` Bart Schaefer [this message]
2011-06-04 21:24 ` Peter Stephenson
2011-06-04 21:34   ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=110604114545.ZM19743@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).