From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15699 invoked from network); 25 Apr 2009 19:56:21 -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; 25 Apr 2009 19:56:21 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 46064 invoked from network); 25 Apr 2009 19:56:11 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 25 Apr 2009 19:56:11 -0000 Received: (qmail 9820 invoked by alias); 25 Apr 2009 19:55:50 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14067 Received: (qmail 9807 invoked from network); 25 Apr 2009 19:55:49 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 25 Apr 2009 19:55:49 -0000 Received: from vms173009pub.verizon.net (vms173009pub.verizon.net [206.46.173.9]) by bifrost.dotsrc.org (Postfix) with ESMTP id 09F798028C72 for ; Sat, 25 Apr 2009 21:54:08 +0200 (CEST) Received: from torch.brasslantern.com ([96.249.201.13]) by vms173009.mailsrvcs.net (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPA id <0KIO001REA08Y7CW@vms173009.mailsrvcs.net> for zsh-users@sunsite.dk; Sat, 25 Apr 2009 14:55:21 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id n3PJtIoQ013004 for ; Sat, 25 Apr 2009 12:55:19 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id n3PJtI5L013003 for zsh-users@sunsite.dk; Sat, 25 Apr 2009 12:55:18 -0700 From: Bart Schaefer Message-id: <090425125518.ZM13002@torch.brasslantern.com> Date: Sat, 25 Apr 2009 12:55:18 -0700 In-reply-to: Comments: In reply to Ian Tegebo "Suggestion: Allow whence to report path(s) for autoloaded functions" (Apr 21, 2:14pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@sunsite.dk Subject: Re: Suggestion: Allow whence to report path(s) for autoloaded functions MIME-version: 1.0 Content-type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV 0.92.1/9289/Sat Apr 25 12:11:31 2009 on bifrost X-Virus-Status: Clean I had something of an afterthought on this one ... On Apr 21, 2:14pm, Ian Tegebo wrote: } } It seems like 'whence -v _MYFUNC' is the intuitive place to look for } this behavior. I'd imagine it working like: } } $ whence -v _MYFUNC } _MYFUNC is a shell function defined in /blah/path/_MYFUNC This information could be misleading. Functions are not always loaded from $fpath; they can be defined in init files, edited and/or hand- entered on the command line, etc. To 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. If _MYFUNC were an executable located in two directories, it would be possible to explicitly choose which to run by typing the full path name as reported by whence. For a function, there's no [straightforward] way to bypass the fpath search order. (The non-straightforward way is to run FPATH=/blah/path_two:"$FPATH" _MYFUNC but that can produce unexpected results if _MYFUNC calls autoloaded functions that should come from /blah/path_one instead.)