From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26681 invoked by alias); 31 Mar 2018 01:00:28 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23292 Received: (qmail 6684 invoked by uid 1010); 31 Mar 2018 01:00:28 -0000 X-Qmail-Scanner-Diagnostics: from mta04.eastlink.ca by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(24.224.136.10):SA:0(-2.6/5.0):. Processed in 1.954463 secs); 31 Mar 2018 01:00:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: rayandrews@eastlink.ca X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | MIME-version: 1.0 Content-transfer-encoding: 8BIT Content-type: text/plain; charset=utf-8; format=flowed X-Authority-Analysis: v=2.3 cv=dfKuI0fe c=1 sm=1 tr=0 a=RnRVsdTsRxS/hkU0yKjOWA==:117 a=RnRVsdTsRxS/hkU0yKjOWA==:17 a=IkcTkHD0fZMA:10 a=gir0-LH0AAAA:8 a=SktrtQ2e_WFPMZWSYAMA:9 a=QEXdDO2ut3YA:10 a=aLewGyoHDmJ4ULJHWpSz:22 X-EL-IP-NOAUTH: 24.207.101.9 Subject: Re: local unfunction To: zsh-users@zsh.org References: <9e0faf6b-b19e-b6d6-0eb7-6ea20b2c2154@eastlink.ca> From: Ray Andrews Message-id: <03b1320b-c248-adbe-55a3-49a3673453bd@eastlink.ca> Date: Fri, 30 Mar 2018 17:30:20 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 In-reply-to: Content-language: en-CA On 30/03/18 11:47 AM, Bart Schaefer wrote: > On Fri, Mar 30, 2018 at 9:11 AM, Ray Andrews 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?