From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7791 invoked from network); 26 Apr 2009 01:39:25 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 26 Apr 2009 01:39:25 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 36019 invoked from network); 26 Apr 2009 01:39:09 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 26 Apr 2009 01:39:09 -0000 Received: (qmail 27114 invoked by alias); 26 Apr 2009 01:38:41 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14068 Received: (qmail 27092 invoked from network); 26 Apr 2009 01:38:39 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 26 Apr 2009 01:38:39 -0000 Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.28]) by bifrost.dotsrc.org (Postfix) with ESMTP id D1E068028C72 for ; Sun, 26 Apr 2009 03:36:56 +0200 (CEST) Received: by yx-out-2324.google.com with SMTP id 8so982683yxg.81 for ; Sat, 25 Apr 2009 18:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=f31ds0r/uj5LwwETgVVtUY5M8Jox059u+yTLgPlbMsc=; b=gkg1WvaMJmBMXFo7Fnb9fIWPsIRuv2S09URCh5dtY6W7p0ZJJjLkyc+filzsyWZKbh YQjLg8JVHnMRF1NcqIQqYvKmQoe2RVyWCUTSCbMZ8vRezATGB+Uq9+6p0MmghfDmYHVb XK5Kr7Rzw6owyPsYmKe3PPcWGajdG5IgLYttw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=qEIN4PXcTYFgtkDxa+/5kjN/HCxeWAuKm+LTXZsVQ8UeFRIv2VtcS5AOod7YYA9eff GlVR8JvxrrTG4T7/GjW5wgZU7l17yWX6X3bW5RNXYraZey3j6M+EHsV6hJG8piRw/Da2 iikiJWtFwqq+RmJM/9EnQEmBRbsa3lLx1Omrg= MIME-Version: 1.0 Received: by 10.151.68.11 with SMTP id v11mr5716298ybk.30.1240709914762; Sat, 25 Apr 2009 18:38:34 -0700 (PDT) In-Reply-To: <090425125518.ZM13002@torch.brasslantern.com> References: <090425125518.ZM13002@torch.brasslantern.com> Date: Sat, 25 Apr 2009 18:38:34 -0700 Message-ID: Subject: Re: Suggestion: Allow whence to report path(s) for autoloaded functions From: Ian Tegebo To: zsh-users@sunsite.dk Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: ClamAV 0.92.1/9289/Sat Apr 25 12:11:31 2009 on bifrost X-Virus-Status: Clean On Sat, Apr 25, 2009 at 12:55 PM, Bart Schaefer wrote: > I had something of an afterthought on this one ... > > On Apr 21, =C2=A02:14pm, Ian Tegebo wrote: > } > } It seems like 'whence -v _MYFUNC' is the intuitive place to look for > } this behavior. =C2=A0I'd imagine it working like: > } > } $ whence -v _MYFUNC > } _MYFUNC is a shell function defined in /blah/path/_MYFUNC > > This information could be misleading. =C2=A0Functions are not always load= ed > from $fpath; they can be defined in init files, edited and/or hand- > entered on the command line, etc. =C2=A0To make whence useful, the shfunc > structure would have to record where the function came from, or whence > must only report the above if the function has NOT YET been loaded. > > There's also the question of what to do about files that are found in > the $fpath directories but are not marked for autoloading. > > } Consequently, removing the '&& break' provides the expected result for > } 'whence -a': > } > } $ whence -av _MYFUNC > } _MYFUNC is a shell function defined in /blah/path_one/_MYFUNC > } _MYFUNC is a shell function defined in /blah/path_two/_MYFUNC > > That's also misleading. =C2=A0If _MYFUNC were an executable located in tw= o > directories, it would be possible to explicitly choose which to run > by typing the full path name as reported by whence. =C2=A0For a function, > there's no [straightforward] way to bypass the fpath search order. > > (The non-straightforward way is to run > =C2=A0 =C2=A0FPATH=3D/blah/path_two:"$FPATH" _MYFUNC > but that can produce unexpected results if _MYFUNC calls autoloaded > functions that should come from /blah/path_one instead.) > Thanks for that. Obviously, I didn't fully appreciate how specific my use case was (nor did I know about the idiom Peter suggested). Now I realize I only wanted a quick way to resolve a named file within a PATH-like structure, and not the more general case about functions that my suggestion implied. --=20 Ian Tegebo