From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6748 invoked by alias); 13 Jan 2017 07:27:46 -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: X-Seq: 22356 Received: (qmail 6322 invoked from network); 13 Jan 2017 07:27:46 -0000 X-Qmail-Scanner-Diagnostics: from mercury.zanshin.com 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(64.84.47.142):SA:0(-0.0/5.0):. Processed in 1.573368 secs); 13 Jan 2017 07:27:46 -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=-0.0 required=5.0 tests=SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at ipost.com designates 64.84.47.142 as permitted sender) Date: Thu, 12 Jan 2017 23:04:30 -0800 (PST) From: Bart Schaefer Reply-To: Bart Schaefer To: zsh-users@zsh.org Subject: Re: `whence -v X` shows file for functions, but not alias; workaround? In-Reply-To: <44e243d5-2423-6d31-4c92-87ff3fe295cd@gmx.com> Message-ID: References: <44e243d5-2423-6d31-4c92-87ff3fe295cd@gmx.com> User-Agent: Alpine 2.00 (LRH 1167 2008-08-23) X-Face: "f/X=UCVgd*^c>+x(gMq0at?e:woX+;'snkkRzc3SX<0AZ (/PS4.M2hzGS9X:Qj]at_H/%a9K}:-eS<"v_7vX84PG9Bf Zpb`wI!I4geY=or+nWq`3CX`oq&TJR;g^ps|7(MH?jh;bs %vHJfCh5>a*6Re5m|Bidja\\o]>n\A)ib1:yX*T`zR(*h~ %tOw<~!D9{e6h!8M2:d8G2@K>y^1I_Vdy\d\MYe]z7c MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Thu, 12 Jan 2017, Eric Cook wrote: > On 01/12/2017 12:24 PM, Timothee Cour wrote: > > * how do i search for where an alias is defined? > > `whence -v my_function`: works > > my_function is a shell function from /home/timothee/.zshrc > > > > `whence -v my_alias`: doesn't do that: > > my_alias is an alias for ... > > Could that be implemented? What's a workaround? (besides grep of course) > > > > * why not also include line info? > > > zsh -lxic : 2> >(grep -F '> alias') That only works if PS4 is not redefined somewhere in the init files, but nice trick. To answer the original question -- function objects track of all of this information because of the delayed (auto)loading feature. It was easy to retain the information and add it to whence's output. (Adding line info would be additional work, that's why not.) Aliases on the other hand use a simple generic hash table element that doesn't have space for a source file name, so it would be a larger effort to rewrite for that -- and it would double or more the amount of space required to store aliases, whereas the space for functions was already committed. And in 20+ years I don't think anyone else has asked about it, so ...