Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: "whence -v" and function file names



On Sun, May 17, 2015 at 10:52 PM, Daniel Hahler
<genml+zsh-workers@xxxxxxxxxx> wrote:
> On 25.04.2015 21:51, Bart Schaefer wrote:
>
>> In workers/34903 I posted a patch to append the function filename (when
>> useful) to the "whence -v" output for functions.  I temporized:
>>
>
> This is a nice addition, but it does not seem to work with compdef functions:
>
> % whence -v _git
> _git is an autoload shell function
> % git <tab>
> % whence -v _git
> _git is a shell function
>
> It would be nice if it could provide the path, at least with the second call.

It's not autoloaded or compdef functions that don't work;
% whence -v _zattr
_zattr is a shell function from
/usr/local/share/zsh/5.0.7-dev-2/functions.zwc/_zattr

but rather, things that redefine themselves from within the function
definition when run that don't;
% grep '^_git()' **/_git
_git() {

% cat foo.z

bar() {}
baz() {baz() {}; baz}

% source foo.z
% whence -v bar baz
bar is a shell function from foo.z
baz is a shell function from foo.z
% bar; baz
% whence -v bar baz
bar is a shell function from foo.z
baz is a shell function

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author