zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: local unfunction
Date: Fri, 30 Mar 2018 17:30:20 -0700	[thread overview]
Message-ID: <03b1320b-c248-adbe-55a3-49a3673453bd@eastlink.ca> (raw)
In-Reply-To: <CAH+w=7aY8CTAKDUO1cyOACYUUATtiKGJAMYutYuh=acMozTxGw@mail.gmail.com>

On 30/03/18 11:47 AM, Bart Schaefer wrote:
> On Fri, Mar 30, 2018 at 9:11 AM, Ray Andrews <rayandrews@eastlink.ca> wrote:
>> Is it possible to unfunction something just within another function?

>> You can get that effect like this:
>>
>> % zmodload zsh/parameter
... that's way beyond my competence Bart but I will study it. However 
I'm playing with Mikael's use of parenthesis -- I'd swear this is the 
first time I've seen any such thing -- and it seems too good to be true, 
so far it just works.  Are there any lurking gotchas?  Disadvantages? It 
doesn't seem any slower.

BTW, just to keep flogging a dead horse:

function test1 ()
{
echo  "\none"
whence -a "zsh"
echo  "\ntwo"
whence -ma "zsh*"
echo  "\nthree"
whence -m "zsh*"
}

one
/usr/local/bin/zsh
/usr/bin/zsh
/bin/zsh

two
/usr/local/bin/zsh    # Missing below
/usr/bin/zsh          # Missing below
/bin/zsh              # Missing below
/aWorking/Bin/zsh5.3  # OK, added as a wildcard match. Executable.

three
/aWorking/Zsh/System/zsh    # Missing above NOT executable, plain text.
/aWorking/Bin/zsh5.3        # Executable, why this and not the others?
/aWorking/Bin/zsh5.3:       # Missing above NOT executable, plain text.

... '-m' by itself seems very strange, but even if we presume that it is 
to show non-executables, it does show one of them while missing all the 
others.  It also missed a non executable in the current directory even 
tho 'dot' is on the path (if we presume it looks for non-executables but 
that's hardly what whence seems to be for).  '-a' and '-ma' seem to 
behave as one might expect.  (I have a bunch of practice targets all 
over the place).  '-m' seems to find executables only if globbing was 
needed to find them, plain vanilla 'zsh' executables are not found.  Is 
this really what is wanted?


  reply	other threads:[~2018-03-31  1:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-30 16:11 Ray Andrews
2018-03-30 18:47 ` Bart Schaefer
2018-03-31  0:30   ` Ray Andrews [this message]
2018-03-31  5:23     ` Bart Schaefer
2018-03-31 14:58       ` Ray Andrews
2018-03-30 20:10 ` 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=03b1320b-c248-adbe-55a3-49a3673453bd@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@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).